Klatuu --- 3rd combo statement wont open query

G

Guest

I copied the 3rd combo statement to be exactly as the second, except to
change field names, but the query wont even open....

dim strWhere As String

If Not IsNull(Me.Combo1) Then
strWhere = "[Field1] = " & Me.Combo1
End If

If Not IsNull(Me.Combo2) Then
If Len(strWhere) > 0 Then
strWhere = strWhere & " And "
End If
strWhere = strwhere & "[Field2] = " & Me.Combo2
End If
........ I left out 3 through 7, but you get the idea, also, I did not
include any delimiters, because I don't know the field data types.

If Not IsNull(Me.Combo8) Then
If Len(strWhere) > 0 Then
strWhere = strWhere & " And "
End If
strWhere = "[Field8] = " & Me.Combo8
End If

Docmd.OpenReport "My ReportName", acPreview, , strWhere
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top