Number of Days between in Parameter Query

  • Thread starter Thread starter ChuckW
  • Start date Start date
C

ChuckW

Hi,

I have an access application with two text boxes: Start
Date and End Date along with a command button that is a
report. In my query that runs the report I have the
following in my Criteria:

Between [Forms]![SelectSalesALL]![txtStartDate] And
[Forms]![SelectSalesALL]![txtEndDate]

I now need to calculate the difference between the two
dates that the user enters into the text boxes. It can
be in another query that reads the first query. Can
someone help?

Thanks,

Chuck
 
Hi,

I have an access application with two text boxes: Start
Date and End Date along with a command button that is a
report. In my query that runs the report I have the
following in my Criteria:

Between [Forms]![SelectSalesALL]![txtStartDate] And
[Forms]![SelectSalesALL]![txtEndDate]

I now need to calculate the difference between the two
dates that the user enters into the text boxes. It can
be in another query that reads the first query. Can
someone help?

Thanks,

Chuck

Why not just do it once in the report?
In an unbound control's Control Source:
=DateDiff("d",([Forms]![SelectSalesALL]![txtStartDate]),([Forms]![SelectSalesALL]![txtEndDate]))

The form must be open when the report is run.
 
You can do it in the query itself as a calculated column

Field: DaysApart: DateDiff("d",[Forms]![SelectSalesALL]![txtStartDate],[Forms]![SelectSalesALL]![txtEndDate])

Or you can use the above expression as the Control source on control on your report.

=DateDiff("d",[Forms]![SelectSalesALL]![txtStartDate],[Forms]![SelectSalesALL]![txtEndDate])
 

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

Back
Top