Problem with public variable - Not possible to get its value
I have created a module where I declare a Public variable.
Code:
Public Const MyVariable = 5
In another form I try to get its value and show it in a MsgBox
I get an empty Msgbox. I don't know why it happens and how I can solve it.
I thought that I would get a Msgbox containing the value 5.
Re: Problem with public variable - Not possible to get its value
You would unless you have another variable defined with the same name or you have a miss spelling on one of those.
Re: Problem with public variable - Not possible to get its value
Quote:
I have created a module where I declare a Public variable.
if it is an object module, you will have to prepend the module name
Re: Problem with public variable - Not possible to get its value
Also note that you should be using Option Explicit in your code to require variable definitions so that you get a compile error when a variable is accessed outside its scope.
Re: Problem with public variable - Not possible to get its value
Hey Data...long time, no hear (my fault, been busy doing other things). Don't know why people don't learn that basic, and I mean, BASIC, "trick" of using OE. Yeah, it took me some time to learn it, as well, but when I did.....NEVER WENT BACK.
Jose, post your project (probably doesn't contain private info)....folks here can IMMEDIATELY identify your REAL issue.
Sammi