Time Function

  • Thread starter Thread starter Armin
  • Start date Start date
A

Armin

Does anyone know how to create a function that would
increase the time in combobox similar to Outlook time box?

12:00 AM
12:15 AM
12:30 AM
..
..

12:00 PM

thanks

Armin
 
Armin,

Why not just use the Microsoft DateTime Picker control?

Insert --> ActiveX Control

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Does anyone know how to create a function that would
increase the time in combobox similar to Outlook time box?

12:00 AM
12:15 AM
12:30 AM
.
.

12:00 PM

thanks

Armin

12:00 PM is Noon.
I suspect you want a full day to 11:45 PM, not to Noon.
If not adjust the code as wanted.
Set the Combo Box Rowsource type to Value List.
In a code event:

Dim GetTime As Date
GetTime = 0#
ComboName.RowSource = GetTime & ","
For intX = 1 To (4*24)-1
GetTime = DateAdd("n", 15, GetTime)
ComboName.RowSource = ComboName.RowSource & GetTime & ","
Next intX

Set the Combo Box Format to Medium Time
 
Thanks,Graham.

I didn't think of that. How do you set the Microsoft
DateTime Picker to show only hours and min. without sec?

Thanks

Armin
 
Thanks Fred.
It works great.

-----Original Message-----


12:00 PM is Noon.
I suspect you want a full day to 11:45 PM, not to Noon.
If not adjust the code as wanted.
Set the Combo Box Rowsource type to Value List.
In a code event:

Dim GetTime As Date
GetTime = 0#
ComboName.RowSource = GetTime & ","
For intX = 1 To (4*24)-1
GetTime = DateAdd("n", 15, GetTime)
ComboName.RowSource = ComboName.RowSource & GetTime & ","
Next intX

Set the Combo Box Format to Medium Time
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Armin,

Right-click the DateTime Picker, and select DTPicker_Object --> Properties
from the context menu. Then set the following properties:
Format = 3 - dptCustom
CustomFormat = hh:mm
UpDown = ticked

You'll still need code to set its current time:
1. Set the form's TimerInterval = 1000 (once per second)
2. Create the following form Timer event procedure:
Private Sub Form_Timer()
Me.DateTimePicker.Value = Now()
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top