WalkieTalkie
Technical User
Hi. I'm having trouble with filtering data in a form. I have unbound text boxes in the form header where the user can type one or more filter criteria, then a command button which applies the filter on the Click event. Here's my code:
My problem is that if the user leaves any of the criteria text boxes blank, then the filter returns no records. I presume this is because the blank text box actually means a null value, and there are no null values in the fields, so therefore the filter returns no records.
I've tried various things, none of which have worked. There must be a simple way to do this?? I appreciate any help!
Code:
Me.Filter = "[Surgeon] = '" & me.txtSurgeon & "' OR [Type] = '" & me.txtType & "' OR [Completed?] = " & me.ckCompleted & " OR [SurgeryDate] Between " & me.txtDate1 & " AND " & me.txtDate2
Me.FilterOn = true
My problem is that if the user leaves any of the criteria text boxes blank, then the filter returns no records. I presume this is because the blank text box actually means a null value, and there are no null values in the fields, so therefore the filter returns no records.
I've tried various things, none of which have worked. There must be a simple way to do this?? I appreciate any help!