If you want to share a variable between procedures in the same module,
declare it using the Private keyword in the Declarations section at the top
of the module (after the Option Compare Database and Option Explicit
statements, and before any procedure definition) ...
Option Compare Database
Option Explict
Private mboolWhatever As Boolean
Public Sub FirstSub()
mboolWhatever = True
End Sub
Public Sub SecondSub()
MsgBox mboolWhatever
End Sub
Don't forget to remove the declaration of the variable from the procedure
where it is now, otherwise they will be two separate and independent
variables. The local variable will be used within the procedure where it is
declared, while the module-level variable will be used by all other
procedures in the module. See the help topics "Understanding the Lifetime of
Variables" and "Understanding Scope and Visibility". (At least, those are
the topic titles in Access 2003. They may vary somewhat in earlier
versions.)
--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com
The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.