Using A Form For Reports

MrsGorilla

Rat Race Participant
Local time
Today, 15:55
Joined
May 6, 2003
Messages
1,745
I have a question and haven't been able to find an answer so far.

I'm trying to put together a form for people to do reporting functions. The reports will all be run off of the same tables, and I'm trying to include options on the form where they can narrow down the results by date, by status, by company, by agent, etc. or any combination of the above, then click a button and have the appropriate report run. I'm having trouble figuring out what the best (and most efficient) way to do this will be.

Can anyone offer up any suggestions or examples that I might be able to look at? Or perhaps an alternative method I maybe haven't thought of?

Thanks in advance for your help.
 
The way i've done this is have the user select the report at the top of the form (using radio buttons), and then select the criteria they want to report on down the bottom (using combo box's mainly).

Then when they click the print button, i build a (rather complex at times) filter (although it actually uses the WHERE condition) that i pass to the report like this:
DoCmd.OpenReport strRptName, acViewPreview, , strCondition
To create the filter u basically have to check each text/combo and add the ones with data to a string, like:
[field1] = '" & txtbox1 & "' AND [field2] = " & cboBox1

Another way u can do it, is to have your queries that each report is based on, look up the values on your report form. But then u can only open those reports when the report form is open (which is not a problem if that is the only place u can print from), otherwise it will ask for parameters. But it saves trying to create compex filters.
 
The example in this thread might help

Thread

This example allows you to choose 1 or multiple criteria and displays the search results in a subfrm but you can change this to open a report instead on click of the search button.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom