Sorting By Dates In An Access Report

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

Guest

I have a report I am trying to run for expired MVR. I still get all of the
report, not just what is prior to the date I enter. This is what I have

DoCmd.OpenReport rptExpiredMVR , , , "cvdate(format([LastMVR],"mm/dd/yyyy"))
< #" & Format(Me.PastDate,[mm/dd/yyyy]) & "#"

Any Ideas?
 
Not sure what you are doing here. Are you trying to find all records where
[LastMVR] is less than a field called [PastDate]? I would think you would
be looking for all cases where [LastMVR] is older than a year ago or
something similar.

In other words, [LastMVR] < DateAdd("Y",Date(),-1)

Or...

DoCmd.OpenReport rptExpiredMVR , , , "[LastMVR] < DateAdd("Y",Date(),-1)"




I have not tested this, and don't know if I am making the right assumption
for your math.
 
PastDate comes from my form where I use a calculation for how many years
back. I put in todays date, how many years back then it gives me the date in
PastDate.
eg: Todays Date: 8/17/2005; Years Back: 4; PastDate:8/17/2001
DateLastMVR is the date in the table from where the sorting is done. I want
it to only give me dates prior to 8/17/2001

Rick B said:
Not sure what you are doing here. Are you trying to find all records where
[LastMVR] is less than a field called [PastDate]? I would think you would
be looking for all cases where [LastMVR] is older than a year ago or
something similar.

In other words, [LastMVR] < DateAdd("Y",Date(),-1)

Or...

DoCmd.OpenReport rptExpiredMVR , , , "[LastMVR] < DateAdd("Y",Date(),-1)"




I have not tested this, and don't know if I am making the right assumption
for your math.


--
Rick B



justlearnin said:
I have a report I am trying to run for expired MVR. I still get all of the
report, not just what is prior to the date I enter. This is what I have

DoCmd.OpenReport rptExpiredMVR , , , "cvdate(format([LastMVR],"mm/dd/yyyy"))
< #" & Format(Me.PastDate,[mm/dd/yyyy]) & "#"

Any Ideas?
 
Back
Top