Filter for a date range on a form

WinDancer

Registered User.
Local time
Today, 03:26
Joined
Oct 29, 2004
Messages
290
What needs to be changed to get this code to work?
No error message, just doesn't filter the record on the form
I want to filter for just those records with the tickle date between today and 10 days from now...
Thanks,
Dave

DoCmd.ApplyFilter , "[tickle date]= between today() and today + 10"
 
What needs to be changed to get this code to work?
No error message, just doesn't filter the record on the form
I want to filter for just those records with the tickle date between today and 10 days from now...
Thanks,
Dave

DoCmd.ApplyFilter , "[tickle date]= between today() and today() + 10"

Have you tried it with red part in it?
 
DoCmd.ApplyFilter , "[tickle date]= Between Date and " & DateAdd("d", 10, Date)

There is no TODAY in Access. It is DATE. Also, you want to make sure you have NO fields, or objects named DATE or else all HE&& will break out.
 
DoCmd.ApplyFilter , "[tickle date]= Between Date and " & DateAdd("d", 10, Date)

There is no TODAY in Access. It is DATE. Also, you want to make sure you have NO fields, or objects named DATE or else all HE&& will break out.

Awesome Bob! I go for the obvious..... obviously.... It never clicked that today is not a function. :o
 
Kryst51, thanks for the suggestion:)
Tried your code Bob [Thanks as always for your help] and it still doesn't limit the records to that range- still does nothing.
I have other filters on this form and they work the way I wanted- just this date range is a problem?
 
Kryst51, thanks for the suggestion:)
Tried your code Bob [Thanks as always for your help] and it still doesn't limit the records to that range- still does nothing.
I have other filters on this form and they work the way I wanted- just this date range is a problem?

You may have to go this route (personally I don't use the DoCmd.ApplyFilter) but I use this instead:

Me.Filter = ...etc.
Me.FilterOn = True


And so using that and modifying the date part:

Me.Filter = "[tickle date] >= #" & Date & "# and [tickle date]<= #" & DateAdd("d", 10, Date) & "#"
Me.FilterOn = True
 

Users who are viewing this thread

Back
Top Bottom