Using Global Variable in Report

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

In a function I've declaired a variable as Public
strVendor as string
In this function strVendor is set to a value.

Within this function I open a report and in it's format
event I try to check the value of strVendor. I keep
getting a Variable Not Defined error. I'm pretty sure
defining the variable again in the report's code is not
the answer because that is resetting the variable to null.
I've done this before but can't remember how. What I'm I
forgetting?

Thanks.

Rick
 
Rick said:
In a function I've declaired a variable as Public
strVendor as string
In this function strVendor is set to a value.

Within this function I open a report and in it's format
event I try to check the value of strVendor. I keep
getting a Variable Not Defined error. I'm pretty sure
defining the variable again in the report's code is not
the answer because that is resetting the variable to null.
I've done this before but can't remember how. What I'm I
forgetting?

Don't declare the variable inside the function. Declare it at the
module level, outside of any procedure, in the Declarations section of a
standard module.
 
Rick said:
In a function I've declaired a variable as Public
strVendor as string
In this function strVendor is set to a value.

Within this function I open a report and in it's format
event I try to check the value of strVendor. I keep
getting a Variable Not Defined error. I'm pretty sure
defining the variable again in the report's code is not
the answer because that is resetting the variable to null.
I've done this before but can't remember how. What I'm I
forgetting?

Thanks.

Rick

The variable must be module level public; that is, the Public
declaration should be at the top of the module (and it must not be a Class).
 
Dirk said:
<g>

Hi, Bas! I noticed you're back. It's good to see you active in the
newsgroups again.
Yes, but I hope not to spend too much time duplexing answers ;-)
 
Back
Top