filtering dates with docmd. command

Blackelise

aka Andrew
Local time
Today, 09:36
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. :)
 
Try adding the #s. as a test.

DoCmd.OpenReport "SalesList", acViewPreview, "", "EstOrd_DateJobCompleted between #" & Me.FromDate & "# and #" & Me.ToDate & "#", , acNormal
 
jdraw, thanks works perfectly!

Blindingly obvious now!!!

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom