Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select records between dates 1

Status
Not open for further replies.

Ezeasy

MIS
Feb 7, 2002
37
US
I want to select records between certain dates. If I place the dates in the criteria section it works great. But what I would like to do is have a table with one record and two fields fromdate and todate. I changed my criteria to look like Between
![fromdate] and
![todate] this causes Access to prompt for dates I don’t want a prompt. I want it to read my table and pull the dates. Does anyone know how to do this? Thanks in advance.
 
table!fromdate and table!todate returns nothing, I think you will need to try something like this

>=DLookUp(&quot;fromdate&quot;,&quot;table&quot;) And <=DLookUp(&quot;todate&quot;,&quot;table&quot;)

dlookup will return a value for it to evaluate.
 
If your table that has the from and to date only have one row then you use a sub query for your criteria. I will call your date table DATETBL.

In the criteria section you would put...
(SELECT FROMDATE FROM DATETBL)
for the from date field of your query and...
(SELECT TODATE FROM DATETBL)

Of course this is just one way of doing it. I'm sure you will get other responses.

Have a happy 4th. prodevmg@yahoo.com
ProDev, MS Access Applications B-)
May God bless you in the year 2002.
 
Hi,
I have used a date/time data type field called dateScheduled in a table called schedules. I would like to retrieve all the records that fall in a specific time period.
I used a query &quot;Select * from schedules where dateScheduled>= #&quot; & cdate(text1) & &quot;# and dateScheduled <= # &quot; & cdate(text2) & &quot;#&quot;

It does not retrieve the records even though though there are tons of them.

Kindly help me. Thanks in advance.
 
Hi Folks,
Please ignore the above message. I accidentally put it down in a reply instead of putting it down as a new thread. I apologize for the inconvenience. Sorry once again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top