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!

display value if date is between dates help!

Status
Not open for further replies.

toon10

Programmer
Mar 26, 2004
303
DE
Hi

My Access is very rusty. I have a query based on a payment table. I have a value field and a date field in the query. I want to have 2 expression fields based on both these fields.

Basically I want to say display the value field if the date field is between now and -30 days and then another to say display the value field if the date field is between -30 days from now and -60 days. (Not sure if that makes much sense!) In other words, display the value fields if the date is within one month or within two months of today's date.

Can anyone help with the syntax?

Thanks
Andrew
 
well if you specifically want 2 queries (sorry if i have read this wrong.

select *
From tableA
where datefield>(getdate()-30)

then for the other one the same barring 60.

Sorry if i have read this wrong.

Dan

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
 
Something like this ?
Value1: IIf(Date()-[date field]<=30, [value field], 0)
Value2: IIf(Date()-[date field]>30 And Date()-[date field]<=60, [value field], 0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for responding guys. PHV's suggestions were spot on!

Cheers again
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top