capogna1
Member
- Local time
- Yesterday, 21:44
- Joined
- Aug 8, 2019
- Messages
- 46
HI I created combo boxes on my form to select what I want to filter and I used the following:
But it's not filtering, anyone can help?
Is there an easier way? Like from Criteria in the query to get a list to pick from? Trying to make something for the user different from applying filters from the query.
Thanks in advance.
Code:
Sub RequeryForm()
Dim strSQL As String
strSQL = ""
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
If Len(strSQL) = 0 Then
Me.FilterOn = False
Else
Me.Filter = strSQL
Me.FilterOn = True
End If
End Sub
Private Sub cboReviewer_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub cboTypeOfEncounter_AfterUpdate()
End Sub
Private Sub Form_AfterUpdate()
RequeryForm
End Sub
But it's not filtering, anyone can help?
Is there an easier way? Like from Criteria in the query to get a list to pick from? Trying to make something for the user different from applying filters from the query.
Thanks in advance.