Combo Box

J

John

Hi

Can you please tell me if there is a routine to list all the times of a
24hr clock in a combo box or do I have to do - combbox1.additem "1am"
etc...

I am writing a database with a calendar.

Thanks

John
 
C

Chris Barber

Write a loop that appends the entries to the combo-box.

eg.

For i = 0 to 23
pstrTemp = Format(i, "00") & ":00"
combo.additem pstrTemp
Next

Chris.

Hi

Can you please tell me if there is a routine to list all the times of a
24hr clock in a combo box or do I have to do - combbox1.additem "1am"
etc...

I am writing a database with a calendar.

Thanks

John
 
J

John

Thanks Chris that works very well, but how do i get it to print the time for
each quater.

e.g 1.15, 1.30, 1.45 etc.

Thanks

John
 
B

Bob Butler

John said:
Thanks Chris that works very well, but how do i get it to print the
time for each quater.

e.g 1.15, 1.30, 1.45 etc.

Combo1.AddItem "Midnight"
For n = 1 To 24 * 4 - 1
If n = 12 * 4 Then
Combo1.AddItem "Noon"
Else
Combo1.AddItem Format$(TimeSerial(0, 15 * n, 0), "h:nn AM/PM")
End If
Next
 
J

John

Cheers bob that was spot on

John


Bob Butler said:
Combo1.AddItem "Midnight"
For n = 1 To 24 * 4 - 1
If n = 12 * 4 Then
Combo1.AddItem "Noon"
Else
Combo1.AddItem Format$(TimeSerial(0, 15 * n, 0), "h:nn AM/PM")
End If
Next
 

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