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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Listbox Value To Macro 1

Status
Not open for further replies.

StrokerAl

Programmer
Feb 21, 2002
4
US
While I am not an Access developer, VB is my game, I am making enhancements to an Access 97 macro-based application. I have a listbox containing report names, and would like to pass the selected value from the listbox to a macro, and then preview the selected report. Any ideas?
 
You can't pass a parameter to a Macro. But you can write VB code to open the report and have the underlying query look at the Value as a global vasriable.

The Global variable needs to be ina Module

like so
Global MyVar

Then have a Public function in that same module like so

Public Function GetMyVar()
GetMyVar = MyVar
End function

Of course you need to assign something to MyVar
before you open the report

MyVar = xxxxx
Docmd.openreport "reportname" , acpreview

DougP, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top