Filtering Between Dates

L

LA Lawyer

I want to filter a report between two dates for the purpose of billing a
specific client. I also want the default start date to be January 1 of the
current year.

I have already obtained: StartDate, EndDate, strClientName.

ClientName and MainDate are the relevant fields on the source table for the
report.

Here is my current code for the filter which does not work:

Reports!BillsReport.Filter = "ClientName ='" & strClientName & "' AND " &
MainDate > StartDate & " AND " & MainDate < EndDate
Reports!BillsReport.FilterOn = True

I have similar code for similar reports which work fine so I know that my
filter is bad.
 
D

Douglas J. Steele

Reports!BillsReport.Filter = "ClientName ='" & strClientName & _
"' AND MainDate > " & Format(StartDate, "\#yyyy\-mm\-dd\#") & _
" AND MainDate < " & Format(EndDate, "\#yyyy\-mm\-dd\#")
Reports!BillsReport.FilterOn = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top