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

Query Criteria Issue

Status
Not open for further replies.

kopy

Technical User
May 30, 2002
141
US
I'm trying to use the following a the criteria for a query.

IIf(DatePart("d",Now())<=10,<=(Month(Now())-2),<=(Month(Now())-1))

Even though the first condition is met, the query returns no records. When I remove the <= signs, the query returns the records for February correctly.

Any insight or help will be greatly appreciated.

Thanks in advance,

Kopy
 
Try moving the operators
Code:
[COLOR=red]<=[/color]IIf(DatePart("d",Now())<=10,(Month(Now())-2),(Month(Now())-1))

[small]On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. (Charles Babbage)[/small]
 
Or even more simply
Code:
<=Month(Now()) - IIf(Day(Now())<=10,2,1)

[small]On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. (Charles Babbage)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top