Display record based on current date

G

Guest

I would like to select records that are valid based on todays date. In this case the records startdate and enddate need to be between todays date

My table has 2 fields stardate and enddate yyyymmdd format as the datatype is long int

An example would be if todays date is 24-05-04 it would return records where 20040524 is between the start and end dates

John H
 
T

tina

criteria in a query would be, roughly,

WHERE StartDate <= Date() And EndDate >= Date()

hth


John H said:
I would like to select records that are valid based on todays date. In
this case the records startdate and enddate need to be between todays date.
My table has 2 fields stardate and enddate yyyymmdd format as the datatype is long int.

An example would be if todays date is 24-05-04 it would return records
where 20040524 is between the start and end dates.
 
D

Douglas J. Steele

I think you're going to need:

WHERE StartDate <= CLng(Format(Date(), "yyyymmdd")) And EndDate >=
CLng(Format(Date(), "yyyymmdd"))

From the Immediate window:

?CLng(Date())
38131
?CLng(Format(Date(), "yyyymmdd"))
20040524
 

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

Similar Threads


Top