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

Date Query

Status
Not open for further replies.

serino

Programmer
Feb 13, 2003
112
US
I cannot get this to work. I am using Access97.

In a query I am trying to create an expression that would show records that are equal to and less than 5 days from the SkedDate field and also meet a certain critera.

Expr1: IIf([Skeddone]=Date(),-5 And [Vendor5]="T-IronW")
 
Try putting the following in the Criteria field for SkedDate:

Between DateDadd("d", -5, Date()) And Date()

and the follwing in the Criteria field for Vendor5:

"T-IronW"

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
I tried as you suggested and added to the critera cell but received the following error.

Function isnt available in expressions in query expression '(((PO401T.SKEDDONE)Between DateAdd("d",-5,Date()) And Date())AND ((PO401T.Vendor5)="T-IronW"))'
 
Lespaul,

I insert this into SQL view but it is requesting an input value for "today". I just want it to show dates equal to and less than 5 days from the skeddone date.

SELECT *
FROM PO401T
WHERE (((PO401T.SkedDone) - Int(Today)<=5) AND ((PO401T.Vendor5)="T-IronW"));
 
sorry, I used the wrong word, it should be Date, Today is the wrong language!

SELECT *
FROM PO401T
WHERE (((PO401T.SkedDone) - Int(Date)<=5) AND ((PO401T.Vendor5)="T-IronW"));

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
It still is asking to input a parameter value for date?
 
maybe:

SELECT *
FROM PO401T
WHERE (((PO401T.SkedDone) - Int(Date())<=5) AND ((PO401T.Vendor5)="T-IronW"));

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top