Dcount between Date Range

K

Kaylen

I would like to count the number of files between two selected dates. I want
the users to enter in the Begin Date and the End date and the Dcount formula
will count the number of files between those two date range. What would be a
formula to put in a query? Thank you for your help.
 
J

Jerry Whittle

Don't use DCount as it can be slow and a proper query can do it faster
without it. Put in the proper field and table names below.

PARAMETERS [Enter Start Date] DateTime,
[Enter End Date] DateTime;
SELECT Count(YourTable.DateField) AS CountOfDates
FROM YourTable
HAVING YourTable.DateField
Between [Enter Start Date] And [Enter End Date];
 
A

amelia

Hi Jerry, I have a question sort of related to "kaylen"

I have a database where I have one field named [date collected] in a table
named [weekly deposits] I want to have a query build a report that shows me
the records that where the [date collected] is between a time period (i am
looking for a weekly period since this is when I do the deposits).

I have tried this:

WHERE ((([Weekly Deposits].[Date Collected]) BETWEEN [mm/dd/yyyy] AND
[mm/dd/yyyy]

I was hoping this would prompt me for 2 dates to enter so the report would
show any records between those 2 dates I enter. It only prompts me once for
the mm/dd/yyyy. So what do I need to do get it to show me records between 2
dates?

Hope this makes sense and I hope you can help!

(I tried the formula you gave Kaylen and it did not work or I did not enter
it correctly.)

Jerry Whittle said:
Don't use DCount as it can be slow and a proper query can do it faster
without it. Put in the proper field and table names below.

PARAMETERS [Enter Start Date] DateTime,
[Enter End Date] DateTime;
SELECT Count(YourTable.DateField) AS CountOfDates
FROM YourTable
HAVING YourTable.DateField
Between [Enter Start Date] And [Enter End Date];

--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Kaylen said:
I would like to count the number of files between two selected dates. I want
the users to enter in the Begin Date and the End date and the Dcount formula
will count the number of files between those two date range. What would be a
formula to put in a query? Thank you for your help.
 

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


Top