[AccessD] Set Report Format

Charlotte Foust cfoust at infostatsystems.com
Thu Jun 3 11:50:26 CDT 2004


The whole point of passing the object is that you don't have to set rpt
to anything except argReport if you desire.  You already have an object,
so it isn't necessary to instantiate it.  You don't even need the rpt
object unless you want to avoid retyping your code.  argReport is
already an object you can use and it inherits the methods and properties
of the kind of object it is.  So you can do things like this:

For Each ctl In argReport.Controls ...

Charlotte Foust

-----Original Message-----
From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] 
Sent: Thursday, June 03, 2004 8:44 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Set Report Format


Charlotte:

Disregard my last message. I changed the function declaration to:

Public Function TranslateControlSubReport(argReport As Object) As
Boolean

but still get a type mismatch on: Set rpt = Reports(argReport).

The calling statement is: Call TranslateControlSubReport(Me)

What am I doing wrong?

TIA

Rocky Smolin
Beach Access Software
http://www.e-z-mrp.com


----- Original Message ----- 
From: "Charlotte Foust" <cfoust at infostatsystems.com>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Thursday, June 03, 2004 9:06 AM
Subject: RE: [AccessD] Set Report Format


> Change the argument to an object, not a report or string.  Pass in the

> subreport or report like this:
>
> Call TranslateControlReport(Me)
>
> Then all the function has to do is test to see if the object is a 
> report or subreport and then loop through its controls collection 
> changing labels.  Since it doesn't have to instantiate anything in the

> function, it doesn't need the name.
>
> Charlotte Foust
>
> -----Original Message-----
> From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com]
> Sent: Thursday, June 03, 2004 7:56 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Set Report Format
>
>
> Charlotte:
>
> In the subreport's Report_Open event I call the routine like this:
>
> Call TranslateControlReport(Me.Name)
>
> But that isn't working.  Is there another way?
>
> TIA
>
> Rocky Smolin
> Beach Access Software
> http://www.e-z-mrp.com
>
>
> ----- Original Message -----
> From: "Charlotte Foust" <cfoust at infostatsystems.com>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Thursday, June 03, 2004 8:41 AM
> Subject: RE: [AccessD] Set Report Format
>
>
> > Rocky,
> >
> > The subreport isn't open in the same sense the parent report is, so 
> > your routine is going to bomb because the subreport won't show up in

> > the reports collection.  I usually pass an object instead of a 
> > string in situations like this, which avoids the problem because the

> > object already exists and doesn't have to be instantiated properly.

> > You can pass Me from the subreport into the function and have it 
> > work without problems.
> >
> > Charlotte Foust
> >
> > -----Original Message-----
> > From: Rocky Smolin - Beach Access Software 
> > [mailto:bchacc at san.rr.com]
> > Sent: Thursday, June 03, 2004 7:34 AM
> > To: AccessD at databaseadvisors.com
> > Subject: [AccessD] Set Report Format
> >
> >
> > Dear List:
> >
> > I am trying to set a variable rpt to a sub report in a Public 
> > function
>
> > (this is for purposes of translating the labels to a foreign 
> > language). I am passing the report name to the function in the 
> > Report_Open event.
> >
> > Setting it to the Main report is no problem.
> >
> > Public Function TranslateControlReport(argReport As String) As 
> > Boolean
> >
> > Dim rpt As Report
> >
> > Set rpt = Reports(argReport)
> >
> > works fine.
> >
> > But in the _Open event of the sub-report when I pass the name of the

> > sub-report to this routine I get a run time error 2451 - the report 
> > name you entered is misspelled or refers to a report that isn't open

> > or doesn't exist.
> >
> > I think it has to do with the fact that I'm only passing the 
> > sub-report name and have to qualify it with the Main report?  But 
> > I've
>
> > tried several syntaxes with no luck.
> >
> > Anybody know?
> >
> > MTIA
> >
> > Rocky Smolin
> > Beach Access Software
> > http://www.e-z-mrp.com
> >
> >
> > But
> > --
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > --
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
>
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list