Dates on reports in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a button on the form, where you pick a date for the report. The report
is for expired MVR, so if I put in 8/17/2004 only dates before that should
show up, but I still have it showing all of the dates, even 2005. Here is
what I have, but doesnt work. Can anyone help me?
DoCmd.OpenReport rptExpiredMVR , , , "cvdate(format([LastMVR],"mm/dd/yyyy"))
< #" & Format(Me.PastDate,[mm/dd/yyyy]) & "#"
 
justlearnin said:
I have a button on the form, where you pick a date for the report.
The report is for expired MVR, so if I put in 8/17/2004 only dates
before that should show up, but I still have it showing all of the
dates, even 2005. Here is what I have, but doesnt work. Can anyone
help me?
DoCmd.OpenReport rptExpiredMVR , , ,
"cvdate(format([LastMVR],"mm/dd/yyyy")) < #" &
Format(Me.PastDate,[mm/dd/yyyy]) & "#"

If the field [LastMVR] has a DataType of DateTime then you don't need to
wrap it in all of those functions which will make it a lot less efficient.
You should always compare directly to the field name whenever possible
otherwise you lose the ability to utilize indexes on the field. You "might"
need the formatting on Me.PastDate, but I would try it first without it.

DoCmd.OpenReport "rptExpiredMVR" , , , "[LastMVR] < #" & Me.PastDate & "#")
 
Back
Top