Repost: Combobox with time values

  • Thread starter Thread starter Silvester
  • Start date Start date
S

Silvester

I have not been able to get any suitable help for this issue from these
newsgroups, so I'm reposting again.

I have a combobox filled with standard meeting timings eg: 9:30 AM, 2:30 PM
etc, stored in a table. So its a combobox based on a lookup table.

If an user enters any new timing I would like that new timing to be added
to the combobox list (i guess through dao recordset). This should be able to
recognise even if the user enters a time in 12 or 24hr formats. I do not use
input masks in the combobox.

How can I achieve this using limitolist & notinlist ?

I have been able to get this to work with strings but not with time
values...
 
How can I achieve this using limitolist & notinlist ?

I have been able to get this to work with strings but not with time
values...

You may not be able to do so!

I'd suggest basing the combo on a query: bind the combo to the
Date/Time field but display a text value generated using the Format()
function. In the not in list event, just add the user's entry to the
table:

Private Sub cboTime_NotInList(Newdata As String, Response as Integer)
StrSQL = "INSERT INTO tblTimes VALUES(" & Format(CDate(Newdata), _
"#hh:nn:ss#") & ");"
DoCmd.RunSQL strSQL
Response = acDataErrAdded
End Sub
 
Back
Top