Just a followup on what I had to do to get this to work.
But first, a little backup. I am running Access 2003, and I
have several reports that I would like to apply filters to.
Each report uses the same parameters. So I built a form
that collected the data needed, then executed the report
with the correct filter defined.
The problematic piece was that I wanted to run this off a
custom menu. The OpenForm option did not work because I
couldn't configure OpenArgs. Also, I couldn't find any
RunCode command that I could attach to a menu.
What I had to do was build a separate macro for each report.
Each macro uses the RunCode feature to run a function,
called RunForm. RunForm has two parameters, the name of the
filter form, and the name of the report. It uses the
DoCmd.OpenForm method to run the passed form, and passes the
Report name in the OpenArgs parameter.
Then, the report collects OpenArgs and configures the
Form.Caption and cmdRunReport command button to show and
execute the correct report.
I really didn't want to have to create an extra database
object for each report. This could have been avoided if
RunCode was available as a menu option.
Kevin Nechodom
Kevin Nechodom<Ke************@nospamhsc.utah.edu>
4/6/2005 2:04:20 PM >>>I am trying to use a consolidated filter form, where I
pass
the desired report I wish to run. I would like to install
this form on my custom menu bars, but I can't figure out
any
way to pass data to the form via the menu.
I have looked for a RunCode menu type, where I could use
DoCmd. I have tried the form type, but I can't access
OpenArgs. Are there any other ideas out there?
Thanks,
Kevin