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

creating a last year date range from current date input 2

Status
Not open for further replies.

bravo6

IS-IT--Management
Mar 23, 2006
83
0
0
US
I have a query that selects invoices from [invoicedatefield] with "Between [forms]![formname]![startdate] And [forms]![formname]![enddate]" in the criteria box. This works fine

I now want to add prior year data in a new query for the same month/day range without having the user need to input another set of dates when they run the form. It seems like "Between ([forms]![formname]![startdate])-365 And ([forms]![formname]![enddate])-365" in the criteria box should work. I also tried removing the "()" and enclosing the "-365 in paraentheses.

No matter what I try, I get an error massage that states:
"The expression is typed incorrctly or is too complicated to be evaluated. For example, a numerica expression may contain too many complicated elements..."

Can anyone help with this please? FYI I am using Access 2003. PLEASE no VBA responses as I am illiterate in VBA.

Thanks
 



Hi,
Code:
Between DateSerial(Year([startdate])-1, Month([startdate]), Day([startdate])) AND DateSerial(Year([enddate])-1, Month([enddate]), Day([enddate]))


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Another way:
Code:
Between DateAdd("yyyy",-1,[forms]![formname]![startdate]) And DateAdd("yyyy",-1,[forms]![formname]![enddate])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top