ansentry
Access amateur
- Local time
- Tomorrow, 08:46
- Joined
- Jun 1, 2003
- Messages
- 995
I have a combo box on a form with the following code in the after upate;
Code
Private Sub cmboFilter_AfterUpdate()
If Me![cmboFilter] = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[RegistrationNumber] = '" & Me![cmboFilter] & "'"
End If
End Sub
Data Source
SELECT DISTINCT RegistrationNumber FROM Qry_RegFilter UNION SELECT "<All>" FROM Qry_RegFilter;
This works fine, BUT the following does not and the only difference is that the look up field OutDate is date format.
Code
Private Sub cmboFilter_AfterUpdate()
If Me![cmboFilter] = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[OutDate] = '" & Me![cmboFilter] & "'"
End If
End Sub
Source
SELECT DISTINCT OutDate FROM Qry_OutDateFilter UNION SELECT "<All>" FROM Qry_OutDateFilter;
Thank you in advance
Code
Private Sub cmboFilter_AfterUpdate()
If Me![cmboFilter] = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[RegistrationNumber] = '" & Me![cmboFilter] & "'"
End If
End Sub
Data Source
SELECT DISTINCT RegistrationNumber FROM Qry_RegFilter UNION SELECT "<All>" FROM Qry_RegFilter;
This works fine, BUT the following does not and the only difference is that the look up field OutDate is date format.
Code
Private Sub cmboFilter_AfterUpdate()
If Me![cmboFilter] = "<All>" Then
DoCmd.ShowAllRecords
Else
DoCmd.ApplyFilter , "[OutDate] = '" & Me![cmboFilter] & "'"
End If
End Sub
Source
SELECT DISTINCT OutDate FROM Qry_OutDateFilter UNION SELECT "<All>" FROM Qry_OutDateFilter;
Thank you in advance