By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,215 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,215 IT Pros & Developers. It's quick & easy.

adding time

P: 14
hello everyone, i have a problem that is probably simple to you to figure out. im using access 07 and novice as hell. I recently created a database form so that i can calculate my non-revenue miles for this transportation service im employed, unfortuntaly those particular hour i dont get paid for. Anyway i created a simple time sheet using military time. example. clock in time 13:00 til 15:00 which is 2 hours worked, but how can i get access to do that. i created an query. the expression is Totalhours:[timeend]-[timestart]= still nothing. can someone help me pls.
Dec 7 '11 #1

✓ answered by ADezii

Expand|Select|Wrap|Line Numbers
  1. TotalHours:DateDiff("h",[TimeStart],[TimeEnd])

Share this Question
Share on Google+
7 Replies


patjones
Expert 100+
P: 931
Is the total hours calculation being done in another text box on the same form? Also, where exactly are you writing out the expression to do the subtraction? Generally, calculated controls need to have the expression put in the Control Source setting in the property sheet.

Pat
Dec 7 '11 #2

ADezii
Expert 5K+
P: 8,679
Expand|Select|Wrap|Line Numbers
  1. TotalHours:DateDiff("h",[TimeStart],[TimeEnd])
Dec 7 '11 #3

P: 14
can i email you guys my dbf so you can see my problem, sorry im so dumbfounded.
Dec 8 '11 #4

ADezii
Expert 5K+
P: 8,679
@jawbone:
Attach you Database to another Post.
Dec 8 '11 #5

NeoPa
Expert Mod 15k+
P: 31,707
How are [TimeEnd] and [TimeStart] defined? If they are both DateTime variables then what you have should already work. Why do you think it isn't? What are you seeing? We cannot help you unless you express the question clearly and keep us fully informed (as we can't see what you're doing - we rely on your question and explanation).
Dec 9 '11 #6

P: 14
thanks NeoPa i change my datatype to DateTime instead of text and it calculated fine. Thanks for your time everyone.
Dec 9 '11 #7

NeoPa
Expert Mod 15k+
P: 31,707
That would certainly explain it.

You may want to select a post here as Best Answer before you go.
Dec 9 '11 #8

Post your reply

Sign in to post your reply or Sign up for a free account.