Textbox for accepting TIME
Textbox1 & 2 will equal a time (based on 24-hr clock).
Textbox1 (Time Clocked In)
Textbox2 (Time Clocked Out)
ttltime1 = Textbox2 - Textbox1
ttltime2 = HOUR(ttltime1) +(MINUTE(ttltime1)/60)
This is what is suppose to take place
User enters time in/out: In = 08:00 (8am) Out = 17:23 (5:23pm)
Textbox1 = 08:00 Textbox2 = 17:23
ttltime1 = Textbox2 - Textbox1 Answer should be 9:23
ttltime2 = HOUR(ttltime1) + (MINUTE(ttltime)/60 Answer should be 9.38
(hrs)
9 23/60 or .38
ttltime2 = 9.38 (hrs worked)
Also, any help with DIM the variables greatly appreciated.
Thanks,
Les
"Bob Phillips" wrote:
Q1. You could format the textbox in its AfterUpdate event
Private Sub TextBox1_AfterUpdate()
With Me.TextBox1
.Text = Format(.Text, "hh:mm AM/PM")
End With
End Sub
Q2. I am getting a value. What is in Textbox1 and 2, and what do you do with
them?
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"WLMPilot" wrote in message
...
I am using a userform to enter Time In/Out via textbox1 (in) & textbox2
(out). Time will be entered based on 24-hr clock, ie 10:00pm is 2200 or
22:00.
Question 1:
Is there a way to format the textbox to include the colon?
Question 2:
I will calculate the difference to determine total hours (with two decimal
places). Currently, this is how I have it (partial macro), but I am
getting
zero as answer.
How is the best way to solve this?
DIM ttltime2 As DOUBLE
ttltime2 = VAL(Textbox2) - VAL(Textbox1)
Thanks and Happy New Year!!
Les
|