Date Guru

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

Guest

Hello All,

I have the last 4 years of records in a table called tblorderdates.
Beginning with the date of 4/5/05, I want to query the records for the
following date ranges:
last 0-12 months
last 13-18 months
last 19-24 months
last 25-36 months
last 37-48 months

For example 0-12. I could use in the date field >#4/4/04 or >#4/4/04 and
<#4/6/05#. How would I calcuate the rest of the ranges? Can this be done with
a query? Or could we set up a form? Thanks for any help!!!!

Bruce D.
 
You should be able to use criterion expressions like this:

Between DateAdd("m", -18, #4/5/2005#) And DateAdd("m", -13, #4/5/2005#)
 
Hey Ken,

I was thinking if there was a way to set up a form and enter the current
date, and the month ranges. Ex: 4/5/2005, 13, 18. Then use those parameters
with the expression you gave me. Then a beginning and ending date would
display showing what the greater and less than dates are based on the ranges.
I need to keep track of what these were and if I could view them it would be
alot easier. Any ideas???

U da man,

Bruce D.
 
Yes....if you have a form named MyFormName, and on it are two textboxes
named txtRange1 and txtRange2, and txtRange1 is the "longest ago" range:

Between DateAdd("m", -Forms!MyFormName!txtRange1, #4/5/2005#) And
DateAdd("m", -Forms!MyFormName!txtRange2, #4/5/2005#)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top