DWUTKA at marlow.com
DWUTKA at marlow.com
Sat Nov 26 12:42:23 CST 2005
Ugh....not this again! LOL. Marty, that is not what happens. If you STOP your code, then everything gets reset. That does include your global variables. It's not a maybe, and they don't 'lose' their values, the code is stopped. It is just like stopping an .exe, all values in memory are cleared. The difference is, with Access, that the Access Shell didn't stop, and as soon as you do something requiring code, Access starts it all up again, and so your Globals will be reset. It's not a wishy washy thing, it is just how the code works. Drew -----Original Message----- From: MartyConnelly [SMTP:martyconnelly at shaw.ca] Sent: Saturday, November 26, 2005 10:51 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Public Variables - Scope and Lifetime If you go into Debug mode with global variables. They maybe reset or lose their values.. Dan Waters wrote: >Borge, > >Have you tried declaring a Public variable at the top of a standard module? > > >With this type of variable, it is always in scope and it always keeps its >value. > >However, be very careful with this if you use that variable in multiple >places in your database. > >Dan Waters > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Borge Hansen >Sent: Friday, November 25, 2005 12:31 AM >To: Access Developers discussion and problem solving >Subject: Re: [AccessD] Public Variables - Scope and Lifetime > >Finally reverted to the old, tried and tested frmSystem hidden form! >As I walk the formatting of the main form and the two major subforms each >having >three subforms, by referencing / setting value of a 'flag' text control on >the >hidden frmSystem I can control the formatting and printing of the >pageheader. >(final output of report is saved as RTF file and further formatted in Word; >found that a repeating groupheader label totally messes up the RTF file >format, >sometimes the groupheader appears in the middle of the page in between the >rows >of data, whereas according to the 'book' a repeating groupheader label >should >appear on top of the page.... not so; hence the need for formatting and >controlling the printing of the pageheader depending on where in the report >we >are....) > >But, what am I missing for achieving the same using a global/public >variable? > >...hmmm maybe it's not a public variable that is needed but an object type >of >thing? > >... perhaps a framework? > >;) > >/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 >> >> >>-- >> -- Marty Connelly Victoria, B.C. Canada -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com