Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't see a public variavle in a subform

Status
Not open for further replies.

cparralesl

Programmer
Jan 27, 2002
118
0
0
NI
Hi everyone:

In a module, Module1, I declared a public booelan variable. Later in form and its subform i can not see it.

Module1
Option Compare Database
Option Explicit

Public ServicioActivado As Boolean


In the load event of my form I do the test:

MsgBox "My Boolean value is: " & ServicioActivado

But my boolean variable appears Empty.

MS Access 2010

I appreciate the help

Thanks





Cesar Humberto Parrales
Application Support
 
What do you mean by empty and I cannot see it? What do you expect to see? Should have a value of 0/false.
 
Are you quite sue that you don't have ServicioActivado declared anywhere else in scope?
 
MajP,

I can't see it means, that i try to use that variable to change it value, but it doesn't appears initializaed, as it never were declared.

To check if the variable is initialized, i create a fresh new form and use the click event of a button that i added in that form. I can view the value variable when i click on that button.

Regarsd,

Cesar Humberto Parrales
Application Support
 
Sorry, I still do not understand. Make sure Option Explicit is used everywhere. Make sure your spelling is correct. You may want to do a search on that variable.

If in a standard module (not a class module) and you do the following.

Code:
Option Compare Database
Option Explicit
Public ServicioActivado As Boolean

Then the variable is declared and initialized with a value of False.

If you then call it from a form
Code:
MsgBox "My Boolean value is: " & ServicioActivado
It will return False. You will get
My Boolean value is: False

Not sure what you are seeing and what you expect to see. But there is no way to get anything different. What does it mean to "not appear initialized"? How would you know if it was not initialized.

 
>there is no way to get anything different

There certainly is. Specifically, if ServicioActivado is declared anywhere else closer in scope than the module, and of a different type (such as an uninitialised string or variant). Hence my earlier question. And Option Explicit won't catch that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top