Full Version: variable availability
UtterAccess Discussion Forums > Microsoft® Access > Access Modules
JimCarney6
is there a way to set a public variable in a subreport and pass its value up to a variable in the main report?

i know i can make a global variable in code module. what i am curious about is doing it just within the reports. the access help file seems to say there is. i cannot tell if i am having a timing problem and so it seems empty, or the variable is simply not available.

i have it declared public at the top of the code module in the subreport. it just shows empty, even though when i debug the subreprt it has a value
Newander5
Unfortunately there is no good way to do this. Public variables are only recognized from code modules, not class objects (which is what the form code is).

I have many a database that contain a module just to define 1 global variable...

HTH,
New
JimCarney6
such was my fear. the access help file states that it should work in all modules all projects, but most else of what i am seeing seems to make it module level only. i changed it to a global and everything worked of course. just wasted my time trying to get it to worked based on the help file.

thank you very much for the post. i would have kept beating my head against the wall trying to make it go
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.