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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date criteria based on another tables date 1

Status
Not open for further replies.

jw5107

Technical User
Jan 20, 2004
294
US
I have two tables in a query. Joined by fldTAIL. One table is aircraft delays and the other is aircraft parts needed for the delays. Both tables have a DATE field in date/time data type. I need to get all the parts needed for the delay (based on the fldTAIL join) 1 day prior to the delay DATE.

Any suggestions?? DateAdd or DateDiff or etc..... and then how??

Thanks in advance,
jw
 
Hi

If I understand your question correctly

SELECT ...whatever ... WHERE tblParts.[datDate] < DateAdd("d",-1,tblDelay.[datDate])

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
KenReay,

Thanks for the fast response!! This is exactly what I needed!!! Thanks!! Star for you!!

jw5107
 
KenReay,

After further tests.....

Its not working the way I thought!!!

When I put this: <DateAdd("d",-1,[Delays]![DATE]) as criteria in a query under the DATE field from the parts needed table - I get parts that are SEVERAL days prior to the delay DATE not just 1.

Any fixes???

jw

 
Hi

well yes

just look at the criteria

< DateAdd("d",-1,[Delays]![DATE])

if you want only 1 day less and nothing else

= DateAdd("d",-1,[Delays]![DATE])



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
KenReay,

I need all parts needed one day less than Delays DATE and all parts needed greater than Delays DATE.
Is that: >= DateAdd("d",-1,[Delays]![DATE]) ??

I'm just havin' a hard time!!!

Thanks for your help!!
jw




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top