Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dim Statment (Global VS. Public or standard) 4

Status
Not open for further replies.

airon

Programmer
Jun 21, 2001
21
US
I have created a reporting DB. The DB generates reports via MS VBA code. there are several modules that are involved in running this DB. I Currently have one Module that holds all Global Declarations for common used variables in all modules.
Question?
Is diming Global Statemts memory intensive compared to Standard Dim?
If I trying to conserve memory used by this reporting DB. Would I be beter off to dim each variable as specific as possible. By specific I mean putting dim statements in each module.
 
Airon,

That depends on the type and amount of data you are allocating to the variable. As a general rule, if a global variable isn't needed, you may want to stick to dimensioning the variable in the module or class module where it is utilized. This ensures that when a particular procedure or fuction has terminated, the memory assigned for that variable will be free again. Hope that helps.

Bernie
 
By definition GLOBAL variables are available throughout the application or database, in this case. Every variable takes up memory. While it does not hurt to have some GLOBAL variables, it has been my experience and understanding that if you can get the job done with standard (PUBLIC and PRIVATE) variable do it.

Larry
SDC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top