Compare and check date

  • Thread starter Thread starter hoachen
  • Start date Start date
H

hoachen

Order# InputDate StartDate EndDate
1 20090914 20090812 20090831
2 20090914 20090915 20100302
3 20090701 20090701 20091031

I am not sure how to run a query that I can compare and check the above
dates. The datatype on inputdate is Text, which I converted into number.
The datatype for startDate and endDate is: number.
my question is: how can I compare and check the date. I want the check
against the startDate with the inputDate. If the startDate more than 6 weeks
of inputDate, then it will not display on the query that I run. Otherwise,
show on the query. I don't really care about the endDate

If someone can help me with this I would be very very appreciated.

Cheer,
hoachen
 
Those may look like dates to you, but to Access, the way you've defined
them, they look like character strings.

If you want to use Access' date/time-related functions, you need to 'feed'
them date/time values.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Order# InputDate StartDate EndDate
1 20090914 20090812 20090831
2 20090914 20090915 20100302
3 20090701 20090701 20091031

I am not sure how to run a query that I can compare and check the above
dates. The datatype on inputdate is Text, which I converted into number.
The datatype for startDate and endDate is: number.
my question is: how can I compare and check the date. I want the check
against the startDate with the inputDate. If the startDate more than 6 weeks
of inputDate, then it will not display on the query that I run. Otherwise,
show on the query. I don't really care about the endDate

If someone can help me with this I would be very very appreciated.

Cheer,
hoachen

Rather than converting to Number (which will sort correctly since it's
yyyymmdd, but won't support any date/time functions), convert it to a Date:

CDate(Format(InputDate, "@@@@/@@/@@"))

will generate a Date/Time value.

Give that you can use

WHERE [StartDate] <= DateAdd('ww", 6, [InputDate])

will display only those records where the dates are six weeks or less apart.
 
Back
Top