[AccessD] Public Variables - Scope and Lifetime

DWUTKA at marlow.com DWUTKA at marlow.com
Fri Nov 25 11:27:40 CST 2005


The code page behind a form or a report is a class module, not a standard
module.  The Public statement in a class module creates a property for that
class. (instant Get and Let basically).  

The reason the 'value' isn't going to be shared between the two, is because
the property is unique on the Report, and the sub report, so changing or
setting it in one doesn't affect the other.

What you need is to put your Global variables into a standard module.  If I
am going to use Global Variables in a project, I will create a module called
modGlobalVariables, and declare all of my Global variables in there.

Drew

	-----Original Message-----
	From:	Borge Hansen [SMTP:pcs at azizaz.com]
	Sent:	Thursday, November 24, 2005 9: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



More information about the AccessD mailing list