Hello,
I am opening a form using a combo box to filter it:
DoCmd.OpenForm "frmListProcDefaults", acNormal, , "ProcName = '" & Me.ProcName & "'"
This works fine.
I added the following on frmListProcDefaults to only show supplies starting with a particular letter entered in a text box (named Only):
Private Sub Only_AfterUpdate()
If IsNull(Me.Only) Then
Me.FilterOn = False
Else
Me.Filter = "[Supplies] Like """ & Me.Only & "*" & """"
Me.FilterOn = True
End If
End Sub
It does only show supplies starting with the letter entered in the text box, but I lose the previous filter applied when form initially opened ("ProcName = '" & Me.ProcName & "'").
I tried combining the 2 like this:
Private Sub Only_AfterUpdate()
If IsNull(Me.Only) Then
Me.FilterOn = False
Else
Me.Filter = "[Supplies] Like """ & Me.Only & "*" & """" And "ProcName = '" & Me.ProcName & "'"
Me.FilterOn = True
End If
End Sub
but I get run-time error 13 Type mismatch.
How do I filter a filtered form without losing original filter? Is the problem with this line:
Me.Filter = "[Supplies] Like """ & Me.Only & "*" & """" And "ProcName = '" & Me.ProcName & "'"
Please help.
Thanks,
Al