filtering dates with docmd. command (1 Viewer)

Blackelise

aka Andrew
Local time
Today, 00:57
Joined
Jun 13, 2012
Messages
35
Hi there,

Please could someone put me straight here!

I just can't get the following to return any reacords...

PHP:
DoCmd.OpenReport "SalesList", acViewPreview, "", "EstOrd_DateJobCompleted between " & Me.FromDate & " and " & Me.ToDate, , acNormal

No errors are displayed, just a blank report.

However it works fine (two records are returned) if I hard code the dates...
PHP:
DoCmd.OpenReport "SalesList", acViewPreview, "", "EstOrd_DateJobCompleted Between #04/12/2012# And #19/12/2012#", , acNormal

in debug I can see that me.FromDate & me.ToDate are exactly the same (minus the #'s) as in the hard coded line above.

Thanks in advance. :)
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 19:57
Joined
Jan 23, 2006
Messages
15,423
Try adding the #s. as a test.

DoCmd.OpenReport "SalesList", acViewPreview, "", "EstOrd_DateJobCompleted between #" & Me.FromDate & "# and #" & Me.ToDate & "#", , acNormal
 

Blackelise

aka Andrew
Local time
Today, 00:57
Joined
Jun 13, 2012
Messages
35
jdraw, thanks works perfectly!

Blindingly obvious now!!!

Thanks again.
 

Users who are viewing this thread

Top Bottom