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!

Use value of global var in a report

Status
Not open for further replies.

jfrizelle

Programmer
Jan 15, 2004
26
0
0
IE
Hi

I've declared a global variable in the General, Declarations, section of my code window (Public gv_Dealer as Integer).

I set the global variable when I select a dealer from a dropdown list on a form, and want to use in to show selection criteria at the top of a report (This report is being run for dealer xxxx).

I have placed a text box on the report, and set its Control Source to =gv_Dealer, but it just pops up a dialog box saying "Enter Parameter Value" when I run the report. I've displayed message boxes at various stages to check that the value is set and is available, and it's fine everywhere else.

Any help appreciated.
Jennie.
 
To my limited understanding, reports act like queries.

Move your Global variable to the Module section

Try creating a function for your variable in the Module section:

Public Function Fngv_Dealer()
Fngv_Dealer = gv_Dealer
End Function

use Fngv_Dealer() as your control source
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top