Date calculation

G

Guest

I'm sure this is simple, but I can't bang my head on the desk anymore today! :0

I'm trying to query and show only dates within a 14 day range. The query
accesses the period end date off of a form (as you can see), since it's
attached to a macro that will print all my reports out at once.

So I input the last day of the period on the form and I want the query to
show me records between 14 days before date and date.

Formula :Between ("dateadd"=("y",-14,[Forms]![frmAddlPayrollReports]![PP End
Date Regular])) And [Forms]![frmAddlPayrollReports]![PP End Date Regular]

I get "Syntax error (comma) in expression".

help?!?! TIA!
 
S

Steve Schapel

jjacob,

Between [Forms]![frmAddlPayrollReports]![PP End Date Regular]-14 And
[Forms]![frmAddlPayrollReports]![PP End Date Regular]

Or, if you prefer...
Between DateAdd("d",-14,[Forms]![frmAddlPayrollReports]![PP End Date
Regular]) And [Forms]![frmAddlPayrollReports]![PP End Date Regular]
 
G

Guest

Thanks Steve, that worked like a charm. I knew it was simple syntax but I'm
a fiarly new user and just didn't get it.

Steve Schapel said:
jjacob,

Between [Forms]![frmAddlPayrollReports]![PP End Date Regular]-14 And
[Forms]![frmAddlPayrollReports]![PP End Date Regular]

Or, if you prefer...
Between DateAdd("d",-14,[Forms]![frmAddlPayrollReports]![PP End Date
Regular]) And [Forms]![frmAddlPayrollReports]![PP End Date Regular]

--
Steve Schapel, Microsoft Access MVP

I'm sure this is simple, but I can't bang my head on the desk anymore today! :0

I'm trying to query and show only dates within a 14 day range. The query
accesses the period end date off of a form (as you can see), since it's
attached to a macro that will print all my reports out at once.

So I input the last day of the period on the form and I want the query to
show me records between 14 days before date and date.

Formula :Between ("dateadd"=("y",-14,[Forms]![frmAddlPayrollReports]![PP End
Date Regular])) And [Forms]![frmAddlPayrollReports]![PP End Date Regular]

I get "Syntax error (comma) in expression".

help?!?! TIA!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

query on date 1
Sorted and Unique Date Period 2
Combine Duplicates in Query 0
Current Date in Query 12
Date Range Issue 3
Between inside IIf on a date query 9
Cross tab query solution 4
Multi table query 1

Top