Date() Problem in Query

  • Thread starter Thread starter JBad
  • Start date Start date
J

JBad

I have to retrieve a list of people whose passports have expired. I have the
list in the access database. Im trying to write a query to filter out those
ppl whose passport has expired since last 30 days from current date and also
those ppl whose passports would be expiring in the next 30 days from current
date. I cant seem to get the data types in dates to match. Can any one help
out please? the passport expiry dates are in the format mm/dd/yyyy and so is
the system date (under regional settings). Im trying to use date() /
formatdate() / cdate() but cant work it out...help!

Tanks..
 
JBad said:
I have to retrieve a list of people whose passports have expired. I
have the list in the access database. Im trying to write a query to
filter out those ppl whose passport has expired since last 30 days
from current date and also those ppl whose passports would be
expiring in the next 30 days from current date. I cant seem to get
the data types in dates to match. Can any one help out please? the
passport expiry dates are in the format mm/dd/yyyy and so is the
system date (under regional settings). Im trying to use date() /
formatdate() / cdate() but cant work it out...help!

Tanks..

SELECT *
FROM TableName
WHERE ExpiredDate >= DateAdd("d", -30, Date())
AND ExpiredDate < DateAdd("d", 31, Date())

With DateTime DataTypes formatting has absolutely nothing to do with
anything other than affecting visual display. A date is a date is a date.
 
Dearest Rick

No wonder u r Access MVP my friend !
It worked beautifully.....thx a million..

Acutally, im kinda new to access n stuff...so if u dnt mind, cud i bother u
on your id ([email protected]) with some other titbit probs i come across ?

thanx in advance ...

jb
 
Back
Top