Display record based on current date

  • Thread starter Thread starter Guest
  • Start date Start 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
 
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.
 
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
 
Back
Top