Unanswered: One form to serve several report options
I am hoping someone will have an answer and help me out. I have several forms with one list box that display the contents based on an underlying query. I also have one report coming off of each of these queries.
On the form, I have provided a combo box to filter the report. Upon selecting from the combo box, the user clicks a button that opens another form (report mode selection) and also passes an openargs as part of it.
The newly opened form gives two Case options: Preview and Print the filtered report (radio buttons) and a click button to confirm that then delivers the selection (preview or print) of the filtered report. This works via a custom function that builds a "where" clause, with the last click appending the where clause (the filter) to the two Case options.
My problem is this: since a user could call a filtered report from any of the forms (and the specific report associated with it), my where clause append in the last click step has to accomodate each of the different arguments. The easy way is to create as many of the report mode selection forms as there are list box forms - but this is highly inefficient. I want to use the one form and for it to know which report, possibly by having another openarg (that identifies the report), in addition to the filter. But the DoCmd.OpenForm statement accepts only one openarg. How does one get around this?
DoCmd.OpenReport strRep, strView, strWh
You now have two billion characters worth of variables you can pass. Also, there is kind of another property you could use for a second opening args - the forms' tag property.
Thanks a bunch for the help. I had to modify your script a little bit, but it works great!
I have another question for you: the "report options" form that I mentioned (that has the selections to preview or print a report) actually has three - the third one being email the report.
Unfortunately, unlike the preview/print which use the DoCmd.OpenReport (that allow the use of a where condition), the email command uses a DoCmd.SendObject that gives me no such option to insert a where clause.
Obviously, if a filtered report needs to be emailed (ie, only the report pertinent to a manager is to be emailed), the where clause is as necessary as it is in the case of preview and print. How do I give this functionality?