I have a search routine - copied from a YouTube video - that searches a given field on a form from a button:
Private Sub SearchMembNo_Click()
Dim S As String
S = InputBox("Enter Membership Number. ", "", StudentMembNo)
If S = "" Then Exit Sub
Me.Filter = "StudentMembNo LIKE ""*" & S & "*"""
Me.FilterOn = True
End Sub
The problem I have is that StudentMembNo is not a mandatory field, so if it is empty on the form record I am on it comes up with:
Run-time error '94':
Invalid use of Null
How can I make the default search blank to avoid this happening?