Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple WhereConditions

Status
Not open for further replies.

Samulayo

Programmer
Aug 13, 2002
46
GB
Hello, I was wondering how it would be possible to have several whereconditions for opening a report based on a query.
I'm using this for a simple search/filter form and i need to be able to pass 3 fields (discipline,userid,date).
The below code will open the report costcode 11 and defines the discipline.

If [cost code] = "P11"
Then
stDocName = "costcode 11"
DoCmd.OpenReport stDocName, acPreview, stDocName, WhereCondition:=Discipline = [Forms]![Report Maker]![Discipline]
End If


I know that I could add the SQL to my code to produce the query, but i'd rather avoid that for now.

Regards
Samulayo
 
Hi Samulayo,

The WhereCondition is exactly that. Any valid SQL Where condition can be used so "Col1 = 1 AND Col2 = 2" should work just fine, but it is a string so make sure you get your quotes in the right place.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top