A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Display record based on current date



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2004, 07:36 AM
John H
external usenet poster
 
Posts: n/a
Default Display record based on current date

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
  #2  
Old May 24th, 2004, 09:29 AM
tina
external usenet poster
 
Posts: n/a
Default Display record based on current date

criteria in a query would be, roughly,

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

hth


"John H" wrote in message
...
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



  #3  
Old May 24th, 2004, 11:07 AM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Display record based on current date

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


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"tina" wrote in message
...
criteria in a query would be, roughly,

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

hth


"John H" wrote in message
...
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





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.