Date Calculation

C

Chris

I have a question...
I am working with a file that say contains dates from January 2009 through
June 2009, there are about 189000 record. I can physically look through the
file and sort it to find out that the date of the first record may be January
12 and the last date may be June 3. I then once I find these 2 dates want to
calculate the number of days that are between the 2 dates to use in a
calculation.

Is there a way that I can have access via some function look through the
values pick out the beginning and the end date and calculate the time elapsed
between the2 dates?

What i am working on at work is a days in accounts receivable outstanding
calculation.

Any assistance would be greatly appreciated.
 
T

Tom Wickerath

Hi Chris,

Try the following query in the sample Northwind database. Just copy this SQL
(Structured Query Language) statement, and paste it into the SQL View of a
new query:

SELECT Min(Orders.OrderDate) AS [Earliest Order],
Max(Orders.OrderDate) AS [Latest Order],
DateDiff("d",[Earliest Order],[Latest Order]) AS [Elapsed Days]
FROM Orders;


Then try running it. If you'd like, you can always switch back to normal
query design view, to see a graphical representation of this query.

For your database, make the appropriate substitutions for the fieldname,
OrderDate, and the name of the table: Orders


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 

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

Top