Checking Time Entries for Accuracy

G

Guest

I am having trouble working with times. I am doing math with time. my
fields are formatted as "Short Time". My fields represent Dispatch Time
("Disp") and Arrival Time ("Arrive"). The program subtracts Dispatch from
Arrival (Arrive - Disp), and I get Response Time ("Resp").

What I want to do is have the program check to make sure they entered both
times correctly. If they did not, the Response Time will be larger than
normal, or out of whack. I already make sure that Arrival is later than
Dispatch.

If Disp.Value > Arrive.Value Then
MsgBox "This Won't Work."
End If

When I try to check if Response time is within limits (normal response time
is 10 minues or less), it does not work. I tried

If Resp.Value > ":10" then
MsgBox "Was your response time more than 10 minutes?"
End If

I also tried "10" in the value area, and it still did not get the correct
response. The Msgbox" area was a little more detailed, but you get the idea.
I think it is the Time format that is messing with me. Any Ideas?
 
G

Guest

Hi Balfour,
I think it is the Time format that is messing with me.

No. A format only affects that way in which data is displayed to the end
user. It does not change the way in which data is actually stored. A
date/time field in a JET database stores the date as an integer, and the time
as a decimal. By definition, a value of zero corresponds to midnight on Dec.
30, 1899.

Today's date Feb. 10, 2007, at 6:00 PM, is represented as: 39123.75. That's
39,123 days since Dec. 30, 1899. The .75 corresponds to 3/4 of a day, which
is what 6:00 PM represents. With this in mind, I think you can see why this
test would fail:
If Resp.Value > ":10" then

Here are some articles that you should find helpful:

How to Calculate Daily Hours Based on Clock In/Clock Out Times
http://support.microsoft.com/?id=237958

Using dates and times in Access
http://office.microsoft.com/en-us/access/HA010546621033.aspx

On time and how much has elapsed
http://office.microsoft.com/en-us/access/HA011102181033.aspx


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 

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