Access 2003 field to calculate time durations

I am using Access 2003, and I am a NEWBIE @ Access, I have 2 fields on a form, START TIME and END TIME. I want to add a field for the duration of time entered. So if the user entered START TIME 10:00 AM and END TIME 11:00 AM the field will populate 1 hour.

The time duratoin will never exceed 24 hours, in fact the duration of time will never exceed 2-3 hours usually. This is for horse riding lessons, and the horses never usually get assigned to a student for more than 1-2 hours at a time.

thx experts...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You should never store a derived result - in this case duration - as it is always available via a query.  

SELECT Rnd(DateDiff("n",[Start Time], [End Time])/60,1) As Duration FROM Mytable

Of course you can select any number of fields before and after the Duration calculation.
Patrick MatthewsCommented:
I agree completely with GRayL: don't store this; instead calculate on demand with a query.

I would calculate it a bit differently, though:

SELECT StartTime, EndTime, 24 * (EndTime - StartTime) AS Hrs
FROM SomeTable

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobrossi56Author Commented:
Great tips guys, and I agree, doing this in a query is fine. I just created a new query using the tblHorseAssign, and I included all the fields in that table, but as a NEWBIE I am clueless where I add this SQL statement to the new query.
bobrossi56Author Commented:
Actually I jut figured out how to add this to a query. BUT.....How do I add it to a form. I need also a field on the form calculating the duration.
Patrick MatthewsCommented:
On a form, just add an unbound textbox, and in the control source for that textbox, use:

=24 * (EndTime - StartTime)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.