Gasman
Enthusiastic Amateur
- Local time
- Today, 14:07
- Joined
- Sep 21, 2011
- Messages
- 17,499
So you could even be bothered to amend the code I had already said needed amending? 
I placed your code from the Form AfterUpdate event into the afterupdate event of each control
I also added Debug.Print to see what the sql code was.
You had a spelling error for Type of Encounter.
You had quotes around a value for a numeric field
Strings need to be surrounded by single quotes ' unless it contains a single quote, then triple double quotes works, I think?
Date literals with # and in mm/dd/yyyy or yyyy-mm-dd format
Numbers do not need anything
This is the resulting code for what you are trying to do.
Code:
If Len(strSQL) > 0 Then
strSQL = strSQL & "And"
End If
I also added Debug.Print to see what the sql code was.
You had a spelling error for Type of Encounter.
You had quotes around a value for a numeric field
Strings need to be surrounded by single quotes ' unless it contains a single quote, then triple double quotes works, I think?
Date literals with # and in mm/dd/yyyy or yyyy-mm-dd format
Numbers do not need anything
This is the resulting code for what you are trying to do.
Code:
Sub RequeryForm()
Dim strSQL As String
If Len("" & Me!cboTypeOfEncounter) > 0 Then
strSQL = "Type_Of_Encounter = '" & Me!cboTypeOfEncounter & "'"
End If
If Len("" & Me!cboReviewer) > 0 Then
If Len(strSQL) > 0 Then
strSQL = strSQL & " And "
End If
strSQL = strSQL & "[Reviewer] = " & Me!cboReviewer
End If
Debug.Print strSQL
If Len(strSQL) = 0 Then
Me.FilterOn = False
Else
Me.Filter = strSQL
Me.FilterOn = True
End If
End Sub