Adding a Filter to a Report

mbemis

New member
Local time
Today, 06:56
Joined
May 31, 2007
Messages
8
Hello once again. I feel like I am a free loader, since I come here to get my questions answered and do not know enough to help anyone else. But I tell you the help is greatly appriciated.

Ok on to my issue. I have a form (frmPaymentSummary) which shows a listbox that shows payment amounts and the dates of the payments from a query. Here I have a filter on the query from a couple of comboboxes in order to show only the information on each customer. Now I am trying to open this data in a form so it can easily be printed. I have created a report(tblPaymentSummary), which opens from a command button on the the form. But I am unable to apply the filter onto the report and it shows all customers. I need help adding the filter into the report. I have attached the DB.

Once again thanks!
Mike
 

Attachments

Change your print button code to this:

If you want to print only record of the Customer and Date selected in the listbox:
Code:
    DoCmd.OpenReport "tblPaymentInfo", acViewPreview, "qryPaymentSummary", "[Customer]='" & Me!txtCustomer & "' AND [Payment Date]=#" & Me.List26.Column(2) & "#"

If you want to print all payments by that customer then use:
Code:
    DoCmd.OpenReport "tblPaymentInfo", acViewPreview, "qryPaymentSummary", "[Customer]='" & Me!txtCustomer & "'"
 
Bob,

It worked like a champ. The code I was using was close, but you know how VB is....

Thanks again,
Mike
 

Users who are viewing this thread

Back
Top Bottom