[AccessD] Public Variables - Scope and Lifetime

Borge Hansen pcs at azizaz.com
Thu Nov 24 22:01:12 CST 2005


I first tried to use an unbound textcontrol  on the main report, setting the
value along the way, referencing the control
me.txtControl
or
me.parent.txtcontrol
However, didn't work......

So I thought: use a public variable.
But how to prevent it going out of scope?

If - as you say - I only have to declare a public variable once, like in the
main report class module, how do I reference and set the value of the variable
within the subreport class module?

This is fundamental stuff, but I never got it (sigh!)

in small font:
/borge
;)




----- Original Message ----- 
From: "Bruen, Bruce" <Bruce.Bruen at railcorp.nsw.gov.au>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Friday, November 25, 2005 1:37 PM
Subject: Re: [AccessD] Public Variables - Scope and Lifetime


> If you declare it in both modules then you will have two variables!
>
> Decalre it in the main and reference it in the sub  --- without thinking
> me.parent.report.somethingorother.pbooletc
>
> Hth
> bruce
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Borge Hansen
> Sent: Friday, 25 November 2005 2:30 PM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Public Variables - Scope and Lifetime
>
> Hi all,
> Please help me here, I am going nuts!
>
> How do I keep the value of a public variable between a Main Report class
> module and Sub Report class module
>
> In the main report class module I have declared the variable:
>
> Option Compare Database
> Option Explicit
> Public pboolPrintPageHeader as boolean
>
> And Similar in the sub report class module:
> Option Compare Database
> Option Explicit
> Public pboolPrintPageHeader as boolean
>
>
> I just want a variable I can control the value of. When running the
> report it switches between the subreport and the mainreport.....
>
> regards
> /borge
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
> This e-mail and any attachments may contain confidential information that is
intended solely for the use of the intended recipient and may be subject to
copyright. If you receive this e-mail in error, please notify the sender
immediately and delete the e-mail and its attachments from your system. You must
not disclose, copy or use any part of this e-mail if you are not the intended
recipient. Any opinion expressed in this e-mail and any attachments is not an
opinion of RailCorp unless stated or apparent from its content. RailCorp is not
responsible for any unauthorised alterations to this e-mail or any attachments.
RailCorp will not incur any liability resulting directly or indirectly as a
result of the recipient accessing any of the attached files that may contain a
virus.
> -- 
> 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