Public variable declaration and usage

R

RipperT

I have declared a Public boolean variable called bFlag in the delcaration
section of a form module. It is set to False in the NotInList event of a
control on the form. That event then opens a new modal, popup form where
bFlag is set to True. Upon closing this new form, the original form tests
for the value of bFlag, which turns out to still be False. My testing shows
that the value of bFlag at the point where it is set to true is True (in the
click event of a cancel button on the popup form), but the value of bFlag
where it is tested later in the NotInList event of the original form is
False. Is the value of bFlag different for each module that uses it? Or can
each module that uses it change it's value and have it be recognized as such
by other modules using it? Access help has frustratingly little to say on
the subject. All it says is that to make a variable available to all modules
in the project to declare it as public.

I just want to know where to start hunting for my solution. Many thanx,

Ripper T
 
M

Mr. B

I have declared a Public boolean variable called bFlag in the delcaration
section of a form module. It is set to False in the NotInList event of a
control on the form. That event then opens a new modal, popup form where
bFlag is set to True. Upon closing this new form, the original form tests
for the value of bFlag, which turns out to still be False. My testing shows
that the value of bFlag at the point where it is set to true is True (in the
click event of a cancel button on the popup form), but the value of bFlag
where it is tested later in the NotInList event of the original form is
False. Is the value of bFlag different for each module that uses it? Or can
each module that uses it change it's value and have it be recognized as such
by other modules using it? Access help has frustratingly little to say on
the subject. All it says is that to make a variable available to all modules
in the project to declare it as public.

I just want to know where to start hunting for my solution. Many thanx,

Ripper T

Any variable declared in a form module is visible only to that form.
If you want the one variable to visible to all forms and code then you
should add a Module and declare the variable as Public in the Module.

HTH

Mr B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top