Im trying to filter records on my form using the enter key.
Like so :
Code:
Private Sub filterplaatsnaam_Enter()
On Error GoTo Err_filterplaatsnaam_Enter
FilterForm
Exit_filterplaatsnaam_Enter:
Exit Sub
Err_filterplaatsnaam_Enter:
MsgBox Err.Description
Resume Exit_filterplaatsnaam_Enter
End Sub
Then the filter form sub :
Code:
Private Sub FilterForm()
Dim strFilter As String
Dim blnFilter As Boolean
blnFilter = False
strFilter = " 1=1 "
If Me.filterplaatsnaam <> "" Then
strFilter = strFilter + " and plaatsnaamobject like '" & filterplaatsnaam & "*'"
blnFilter = True
End If
If Me.fldFilterObject <> "" Then
strFilter = strFilter + " and NaamObject like '" & fldFilterObject & "*'"
blnFilter = True
End If
If Me.kzlFlterObject <> "" Then
strFilter = strFilter + " and SoortObject like '" & kzlFlterObject & "*'"
blnFilter = True
End If
If blnFilter Then
Me.Filter = strFilter
Else
Me.Filter = "1=2"
End If
Me.FilterOn = True
End Sub
Its just that when i move from one field i search in to the other, the filter is applyed.
Also, the field kzlFlterObject is an drop down menu, and the filter doesn't work on that field.
Any ideas ?