Adding up Time in a text box on a userform

G

gonecrazybacksoon

Hi All

Please help with the following:


I am building a time management tool in the form of a userform that
logs the time of a particular event, using just the system time, and
then based on another input(Combobox8), ie: the priority of the
event,
another textbox has to display the time a person should attend to the
problem.


For eg: when a call is logged, the system time is stamped onto
textbox1 showing the start time. Then the user has to input either
the
numbers 1 through 5 (priority) meaning: 1 means you have to attend
the
call in 4 hours, 2 means 8 hours, 3 means 12 hours, 4 means 24 hours
and 5 means 48 hours.


So, if textbox1 is stamped at 1:30:00pm, and I input a 2 for the
priority, textbox39 should display 9:30:00pm.


This all seems to work fine unless I input priority 3.4 or 5... the
date goes completely wierd and say something like 1899/05/15 ....
don't understand why.


The code I'm using is simply :


If ComboBox8.Value = 1 Then
TextBox39.Text = Time + TimeValue("04:00:00")


and so on ...until priority 5


Please help...


Sachin Singh
 
M

merjet

Instead of using TimeValue, try using the time in days --
4/24, 8/24, 12/24, 1 , 2

Hth,
Merjet
 
M

merjet

P.S. Also try using Now instead of Time, e.g.
TextBox39.Text = Now + 4/24
Hth,
Merjet
 
G

gonecrazybacksoon

P.S. Also try using Now instead of Time, e.g.
TextBox39.Text = Now + 4/24
Hth,
Merjet

Thanx a lot mate,

This seems to work better when going past midnight, and I don't get
the strange year (1899) coming up any longer.

The only problem now is that Now + 4/24 adds 4 hours to the PC time at
the moment....
I need it to add four hours to the time logged in another textbox...
when a call is logged, the date and time are stamped into textbox
3...eg: 2008/15/05 03:54:05PM....
when I input the priority number, I need it to add 4 hours to the Time
and Date in textbox 3, not the "now" time.
Any ideas there??
 

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