I have some querydefs running in my database and I love how efficient they are........I am pretty much a novice at it.
I am building a version 2 accounts receivable database and really want to build on querydefs to reduce the number of queries I have in version 1.

What I can't figure out is how to write mutliple where clauses on different datatypes.
I have one query that pulls all the invoice and payment information I need to make mulitple reports. The where clause variations I will need are:

I'm having trouble figuring out the punctuation and bracketing

1.) salesman (number) = form field combobox
Each invoice can have up to three salesman on it - so I need my 3 query feilds to match the foam field combobox. So form field combobox should be SLMN1, OR SLMN2 OR SLMN3
where = where & " AND [SLMN1] = '" + Me![txtSLMN] + "'" OR [SLMN2] = '" + Me![txtSLMN] + "'" OR [SLMN3] = '" + Me![txtSLMN] + "'"

2.) the account is not frozen (text)
where = where & "AND [Unapplied] = '" NotNull ?
only give me accounts where this field is blank

3.) invoice date variations (date)
a. where ((([DUE]>Date()) = 0 ))
b. where (((TG.DUE)<[Forms]![Switchboard]![sfPeriodNow].Form![PEREND]))

4.) old invoices (number)
where (([AGE])>89);

5.) profit targets (number)
WHERE (((TG.COMM)>900))

If I start with my own code example below, how would I write up to 5 different where clauses?
I won't be transferring spreadsheet for these, i will be opening reports which I know how to do

I have 6 different buttons.
here are examples of what I am running now:
Code:
Private Sub CustPOexport_Click()
Dim DB As DAO.Database
Dim QD As QueryDef
Dim where As Variant

Set DB = CurrentDb()

On Error Resume Next
DB.QueryDefs.Delete ("Customers_History")
On Error GoTo 0

where = where & " AND [CUSTPO] = '" + Me![txtCUSTPO] + "'"

Set QD = DB.CreateQueryDef("Customers_History", "Select * from qryPODEFS " & (" where " & Mid(where, 5) & ";"))
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Customers_History", "H:\Collections\TEMPLATE CUSTPO", 0

End Sub
and using the same qry's I can also:
Code:
Private Sub NEexport_Click()
Dim DB As DAO.Database
Dim QD As QueryDef
Dim where As Variant

Set DB = CurrentDb()

On Error Resume Next
DB.QueryDefs.Delete ("Customers_History")
On Error GoTo 0


where = where & " AND [NENO] LIKE '" & Me![txtNENO] & "***'"

Set QD = DB.CreateQueryDef("Customers_History", "Select * from qryPODEFS " & (" where " & Mid(where, 5) & ";"))
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Customers_History", "H:\Collections\TEMPLATE NENO", 0

End Sub