Date calcualation

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

I have three fields: Start Date, End Date & Duration. For example, Start
Date is 12/10/07, End Date is 12/10/07 and the Duration is a calculation
field and the result is 0. How can I make it 1?

Thanks,

Scott
 
I have three fields: Start Date, End Date & Duration. For example, Start
Date is 12/10/07, End Date is 12/10/07 and the Duration is a calculation
field and the result is 0. How can I make it 1?

What result would you want if End Date is 12/11/07? Also 1? If so:

IIF([Start Date] = [End Date], 1, DateDiff("d", [Start Date], [End Date])

John W. Vinson [MVP]
 
John,

Thanks for your formula. For 13 October, I want the result of 2.

Scott

John W. Vinson said:
I have three fields: Start Date, End Date & Duration. For example, Start
Date is 12/10/07, End Date is 12/10/07 and the Duration is a calculation
field and the result is 0. How can I make it 1?

What result would you want if End Date is 12/11/07? Also 1? If so:

IIF([Start Date] = [End Date], 1, DateDiff("d", [Start Date], [End Date])

John W. Vinson [MVP]
 
John,

Thanks for your formula. For 13 October, I want the result of 2.

Scott

John W. Vinson said:
I have three fields: Start Date, End Date & Duration. For example, Start
Date is 12/10/07, End Date is 12/10/07 and the Duration is a calculation
field and the result is 0. How can I make it 1?

What result would you want if End Date is 12/11/07? Also 1? If so:

IIF([Start Date] = [End Date], 1, DateDiff("d", [Start Date], [End Date])

John W. Vinson [MVP]

I'm not sure I understand. Note that Access literal ##/##/#### dates in
Queries are always interpreted as American format, month-day-year - regardless
of your computer's date preferences!

DateDiff("d", Startdate, Enddate) will return the number of midnights between
Startdate and Enddate. You can add one to that result if you want to count the
start date as a full day.

John W. Vinson [MVP]
 

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

Update End Date 5
Need help counting records by date 1
Calculated Field 4
Update Query 1
help date and sum 3
Between Date 10
dlookup help 2
Average interpurchase times 4

Back
Top