Declare a variable

krester

Registered User.
Local time
Today, 10:14
Joined
Aug 29, 2007
Messages
31
Hi all,
I'm trying to declare a variable that will be accessible in some forms.
I declare it in general declaration (in one of the forms) as public, but when the program get to a different form it's not recognize it.
I'm stuck…:confused:
 
Last edited:
You need to declare a global variable in a standard module:
  1. From the Objects Dialog Box click on "Modules"
  2. Click on New
  3. Enter you variable

Examples:

Public Hits As Single
Public TotalActive As Long
Public intEntryBehavior As Integer
Public strCurrPt As String
Public DDate As Date
Public SCSwitch As Boolean

Save and name the module.

Note that some people will preach against using global variables. They do have a drawback in that if Access pops an error, their value will be lost, so you need to be careful about planning/debugging your app.

Linq ;0)>
 
Thank you Missinglinq for your help and for the remark, now I can continue :).
 
Glad we could help! I personally use Global Variables, when appropriate and nothing else will work, and have never had any problems. But I work to make sure that my is bug free.

Good luck!

Linq
 

Users who are viewing this thread

Back
Top Bottom