Can't Filter Date/Time With Combo Box

vdanelia

Registered User.
Local time
Today, 05:07
Joined
Jan 29, 2011
Messages
215
Hello Friends, Need Help!

I have a form where I filter the data by Combos, all data is filtered except Date/Time (Displaying Error) My filter form is based on Query [Filter], My form is Continuous Form..
I use On Combo After Update :

Private Sub FData_AfterUpdate()
Me.Filter = "[DateOfPurchase] = '" & Me.FData & "'"
Me.FilterOn = True
End Sub

And on Combos Row Source:
SELECT [FILTER].[DateOfPurchase] FROM FILTER;

All other combos are filtering the data perfectly..
What I'm doing wrong, I'm Confused

Thank you in Advanced
 
Naming a query FILTER is a bad idea as that is an Access Reserved Word. You need to either change the name or use square brackets around it but I would seriously say you need to change the name.

Also, if you are referring to a date datatype (field is date/time), you don't use QUOTES to delimit dates, you use OCTOTHORPES (#):

Me.Filter = "[DateOfPurchase] = #" & Me.FData & "#"
 
Thank you Bob.... Working Perfectly....

Thanks for the suggestion I renamed it as QFilter, I think it is Normal and will not interfere with Access reserved word :)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom