S
SarahEGray
I have created a continuous form within an Internal Audit database and want
to be able to filter by a From and To Date range and a name. I have set it
up and at the back entered the following code to the Apply Filter button but
I keep getting "Variable not Defined". I have tried lots of things but
cannot sort it. Any suggestions? I have put a note of the code used below.
Private Sub Command9_Click()
Me.Filter = "1=1"
'Response Due Date
If Not IsNull(Me.txtResponseDateFrom) Then
Me.Filter = Me.Filter & " AND [Responseduebydate] >= #" &
FormatDateTime(Me.txtResponseDateFrom.Value, vbLongDate) & "#"
End If
If Not IsNull(Me.txtResponseDateTo) Then
Me.Filter = Me.Filter & " AND [Responseduebydate] >= #" &
FormatDateTime(Me.txtResponseDateTo.Value, vbLongDate) & "#"
End If
If Not IsNull(Me.txtContact) Then
Me.Filter = Me.Filter & " AND [PersonContacted]= '" & Me.txtContact
& "'"
End If
Me.FilterOn = True
Me.Requery
End Sub
to be able to filter by a From and To Date range and a name. I have set it
up and at the back entered the following code to the Apply Filter button but
I keep getting "Variable not Defined". I have tried lots of things but
cannot sort it. Any suggestions? I have put a note of the code used below.
Private Sub Command9_Click()
Me.Filter = "1=1"
'Response Due Date
If Not IsNull(Me.txtResponseDateFrom) Then
Me.Filter = Me.Filter & " AND [Responseduebydate] >= #" &
FormatDateTime(Me.txtResponseDateFrom.Value, vbLongDate) & "#"
End If
If Not IsNull(Me.txtResponseDateTo) Then
Me.Filter = Me.Filter & " AND [Responseduebydate] >= #" &
FormatDateTime(Me.txtResponseDateTo.Value, vbLongDate) & "#"
End If
If Not IsNull(Me.txtContact) Then
Me.Filter = Me.Filter & " AND [PersonContacted]= '" & Me.txtContact
& "'"
End If
Me.FilterOn = True
Me.Requery
End Sub