-
Hi! i read somewhere ages ago how you can dim something as global so that you can access it in different subs..but i cant remember how to do it. can anyone plz tell me
like i want to dim x as a global integer but it comes up with compile error: expected: New or type name
------------------
*~Kezza!~*
-
in a Module
Public x as Integer
-
In the Declarationns section on a form:
Dim MyVar as Long
-
Depends what scope you require,
Rodik's reply will make it accessable to all parts of the form whereas mine will be accessable to all forms and modules.
You shouldn't really use a Public in a module if it is only used in one Form, so take your pick!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
Or, to be really naughty put
Global [variable] as [type]
in the declarations section of a module. Then it is visible to everything in the program. Sometimes this can be quite useful though 'real' programmers don't tend to use too many of them...
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]