"Berny" <BlancoB at msn Dot com> wrote in message
news:%234lf%(E-Mail Removed)
> Can anyone help me on this one or at lease tell me if it can be done.
>
> I'm trying to declare a variable once that can be used by all of the
> functions/procedures in the module/project.
>
> dim strVar as string
>
> strVar = "1.1b"
>
> I can't seem to make it work.
You have to declare the variable at the module level in a standard
module (not a form, report, or class module), and it must be declared
with the Public keyword; e.g.,
Public strVar As String
You should be aware that under some circumstances the value of a global
variable can be lost. For example, an unhandled error will cause your
VB project to be reset, and that will erase all the values of public
variables. So if you want to use a global variable to hold data for an
extended period, you'd better include code to check that the variable
still has a value, and reload it if necessary.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)