Well, that suggestion was based on this "Actually I'd have it in a standard module". That's where it would need to be to be declared like I did. Does this work?
Code:
Const conJetDate = "\#mm\/dd\/yyyy\#"
If Not IsNull(Me.cboSurgeonSearch) Then
strWhere = strWhere & "([Surgeon] = '" & Me.cboSurgeonSearch & "') AND "
End If
If Not IsNull(Me.cboProcSearch) Then
strWhere = strWhere & "([procedure] = '" & Me.cboProcSearch & "') AND "
End If
If Not IsNull(Me.txtEndDate) Then
strWhere = strWhere & "([OpDate] < " & Format(CDate(Me.txtEndDate) + 1, conJetDate) & ") AND "
End If
If Not IsNull(Me.txtStartDate) Then
strWhere = strWhere & "([OpDate] >= " & Format(Me.txtStartDate, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
Me.Refresh
End If