Date Filter DoCmd.OpenForm Problem

DemonHub

Registered User.
Local time
Today, 18:23
Joined
Jul 26, 2005
Messages
14
I have this code when I open a form.


stLinkCriteria = "[Date]=" & Format(Now(), "yy-mm-dd")

stDocName = "FeuilleTemps"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria


When the form open a Filter is on and in the date criteria it's 5-9-20
And in my date field it's 05-09-20 , so the filter don't work.

And when I put

stLinkCriteria = "[Date]=" & "#" & Format(Now(), "yy-mm-dd") & "#"


The date criteria is now #20-05-09# and it's not what I want.

I want #05-09-20# (yy-mm-aa) automaticly in my criteria when my form open, because all my date is in that format.

I really need this to work and I don't have any clue to solve this problem.

Thanks for the help
 
stLinkCriteria = "[Date]=#" & Format(Date(), "d/m/yyyy") & "#"


Note
In code, Access may change Date() to Date.

Date is a function name. Avoid using it as a field name.
.
 
Thx you gave me what I except , thanks alot :D
 
Last edited:

Users who are viewing this thread

Back
Top Bottom