How to use 3 criterias in filtering a report using VB

irslan rafique

Registered User.
Local time
Tomorrow, 05:16
Joined
Oct 17, 2014
Messages
26
Hi,
My report(Invoice) is based on a query.
I am filtering report(on a filed 'DriversName') using following command:

DoCmd.OpenReport "Invoice", acViewPreview, , "DriversName like '*" & txtname & "*'"(working fine)

Can anybody tell me please that how to use 3 criteria or two more filters in same command.

1st Criteria: DriversName (Text)
2nd Criteria: Month (Text)
3rd Criteria: Year (Number)

Your early and prompt help will be highly appreciated.

Thanks in advance
 
Please do not double post - other thread here

http://www.access-programmers.co.uk/forums/showthread.php?t=273743

In answer to your question you use AND or OR depending on requirements

DoCmd.OpenReport "Invoice", acViewPreview, , "DriversName like '*" & txtname & "*' AND myMonth='" & txtMonth & "' AND myYear=" & txtYear

Note that month and year are reserved words and using them as field or table names can have unintended consequences
 

Users who are viewing this thread

Back
Top Bottom