Report based on Query

mugman17

Registered User.
Local time
Today, 13:01
Joined
Nov 17, 2000
Messages
110
I have a report that is generated from a query. Basically, you enter the company name on a form and it creates a report that gives the totals for the month. What I would like to do is, if the Supplier Name is not selected, it will generate the reports for all the suppliers.
 
Think the wires are a little crossed. First you said "company name" and then "supplier".

So I'm taking a guess that you meant the same thing for both. In which I case I would answer..

You could also run some code on your event to change the recordsource of the report based on the value of the choice control.
 
I would copy the query and delete the criteria that makes you select a company name you will also need a new report based on th copied query this should give a report for all companies.
 
I know I need to add some code, but I cannot get anything to work properly.
 
Put this code on the event that runs your report.

If IsNull(Me.ChoiceControlName) Then
DoCmd.OpenReport "ReportName", acViewPreview
Exit Sub

Else

DoCmd.OpenReport "ReportName", acViewPreview, , "[ControlNameOnReport] = " & Me.ChoiceControlName


End If


PS. You can change the recordsource of your report to the table that you were using in your query now. With this code, the report is queried.


[This message has been edited by jwindon (edited 10-31-2001).]
 

Users who are viewing this thread

Back
Top Bottom