PDA

View Full Version : Multiple Criteria in Access



ramesh
November 6, 2007, 04:14 PM
I have a project opening a report from a selected Access Database. The report uses a query from 'SaleTransactions' that has the following criteria:

[Start Date]
[End Date]
[Supplier_Name]

At the moment the database launches the report it (the report) asks the user for input for the criteria above. I want the user to use two DTPickers and a text box to select their input and the program to output it to the report.

So far I have this:


Dim apAccess As Access.Application
Set apAccess = New Access.Application

Dim sCriteria As String
sCriteria = "myField = 'this criteria'" 'use this to pass a criteria if you need one

apAccess.OpenCurrentDatabase ("t:\data\OchoRiosSales.mdb" )
apAccess.DoCmd.OpenReport "SaleTransactions", acPreview, , sCriteria

apAccess.Quit
Set apAccess = Nothing
However, this assumes I only have one criteria to input. How do I pass multiple criteria input to the database? Or is there a way I can modify the sCriteria string to include multiple criteria?

samuelmitch
November 6, 2007, 08:10 PM
look at this link
http://www.access-programmers.co.uk/forums/showthread.php?t=50391

i hope it helps