Drop Down Box Question

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

I have a drop down box that brings in times from a table. They appear as
follows:-

RealTime Time
0:15 15 mins
0:30 30 mins
0:45 45 mins
1:00 1 hour
1:30 1.5 hours
2:00 2 hours

In the drop down box they user only sees the Time i.e. 15 mins, 30 mins etc
etc

I am trying to do a calculation of an appoinment start date, then add the
appoinment time, but because it's in a drop down box I get a type mismatch
error, because the drop down box is using the time as text not a time.

If anyone can let me in on how I could do this, it would be appreciated. If
more details are required, let me know please.

TIA
Stephen
 
In your code, you can use the CDate() function to convert the time text to
DateTime value. For example:

?CDate("0:15")
00:15:00

OTOH, if the data comes from a Look-Up Table and the first Column of the
ComboBox is invisible to the user, you can change the RealTime Field of the
Look-up Table to Integer / Long and store the *actual* number of minutes.
In this case, you can use the duration in minutes directly in your DateAdd
(which is also used for time-adding) calculations.
 
Back
Top