Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Declaring and Using Global Variables in Access VBA

Reply  
Thread Tools
SimonB's Avatar
Computer Specs
Junior Member with 24 posts.
 
Join Date: Sep 2004
Location: Boston, MA, USA area
Experience: Intermediate
07-Aug-2008, 11:32 AM #1
Question Declaring and Using Global Variables in Access VBA
I want to refer to a global variable from multiple modules in Access VBA code. In reading the "books" it would appear that a "Public" variable should serve this purpose, but I can't seem to get it to be recognized beyond the module in which I declare it. How do I declare it as soon as the database opens, and what do I need to do to have it be available to any procedure throughout the current session on the database, both for using its currant value, and for changing that value?

I have a similar issue with defining a constant to be used by the database any time it opens. I want the programmer to declare a value for a public/global loop limit that he might need to adjust depending on operational user feedback. The public/global variable allows it to be set and changed in only one central place rather than having to change it in every location where it is used.

I think these are both the same issue.

Any help would be appreciated.

Simon B.
Reply

Tags
access, global variables, vba

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:13 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.