OpenReport Method W Multiple Criteria

clauses

Registered User.
Local time
Today, 00:37
Joined
Feb 9, 2001
Messages
56
I am trying to open a report from a form. The report is based on a query that uses several fields from the form as criteria. I am having trouble using the openreport method using multiple fields from the form. I keep getting an error that tells me my expression is to complex. The expresion I am using is taking the form:

ptrCriteria = "Field 1 = '" & Me!formValue1 & "' AND"
ptrCriteria = ptrCriteria & "Field 2 = '" & me!formValue2 & "'"
ptrCriteria = ptrCriteria & " AND Field3 = '"
ptrCriteria = ptrcriteria & Me!formValue3 & "'"
 
Try this:

ptrCriteria = "Field 1 = '" & Me!formValue1 & "' AND Field 2 = '" & me!formValue2 & "' AND Field3 = '" & Me!formValue3 & "'"

I think you missed a few single quotes in there. You can always use MsgBox ptrCriteria to see if it makes sense before you run it.
 

Users who are viewing this thread

Back
Top Bottom