monkeylizard
MIS
I am attempting to provide users with a combo box to select a time in 30 minute intervals between 6:00a and 7:00p. I then store that time (along with a date captured in a 3rd party date control) in a SQL table in a datetime field.
This works fine. When I retrieve the recordset, I can get the date control to set from the datetime field, but not the combo box for the time.
This is where I set the valid values for the time combo
This is where I'm attempting to retrieve the time value from the recordset. strHold is set correctly, but the second line always leaves cCombo.Text = ""
strHold is equal to one of the values in the .AddItem routine above, but the combo box has a blank as its retrieved value.
Combo Style is 2-Dropdown List because I don't want the users to be able to free-form data. If I change the style to 0-Dropdown Combo, it works. But this allows the user to enter their own values.
Any ideas on how I can get this time value from the datetime field in the recordset to set the combo box to the right selection and keep the users locked out of free-form?
Monkeylizard
Sometimes just a few hours of trial and error debugging can save minutes of reading manuals.
This works fine. When I retrieve the recordset, I can get the date control to set from the datetime field, but not the combo box for the time.
This is where I set the valid values for the time combo
Code:
cCombo.AddItem ("6:00 AM")
cCombo.AddItem ("6:30 AM")
cCombo.AddItem ("7:00 AM")
cCombo.AddItem ("7:30 AM")
cCombo.AddItem ("8:00 AM")
cCombo.AddItem ("8:30 AM")
cCombo.AddItem ("9:00 AM")
cCombo.AddItem ("9:30 AM")
cCombo.AddItem ("10:00 AM")
cCombo.AddItem ("10:30 AM")
cCombo.AddItem ("11:00 AM")
cCombo.AddItem ("11:30 AM")
cCombo.AddItem ("12:00 PM")
cCombo.AddItem ("12:30 PM")
cCombo.AddItem ("1:00 PM")
cCombo.AddItem ("1:30 PM")
cCombo.AddItem ("2:00 PM")
cCombo.AddItem ("2:30 PM")
cCombo.AddItem ("3:00 PM")
cCombo.AddItem ("3:30 PM")
cCombo.AddItem ("4:00 PM")
cCombo.AddItem ("4:30 PM")
cCombo.AddItem ("5:00 PM")
cCombo.AddItem ("5:30 PM")
cCombo.AddItem ("6:00 PM")
cCombo.AddItem ("6:30 PM")
cCombo.AddItem ("7:00 PM")
This is where I'm attempting to retrieve the time value from the recordset. strHold is set correctly, but the second line always leaves cCombo.Text = ""
Code:
strHold = Trim(Format(cCase.P_ADO_Recordset("INSPECT_DT"), "H:MM AMPM"))
cCombo.Text = strHold
strHold is equal to one of the values in the .AddItem routine above, but the combo box has a blank as its retrieved value.
Combo Style is 2-Dropdown List because I don't want the users to be able to free-form data. If I change the style to 0-Dropdown Combo, it works. But this allows the user to enter their own values.
Any ideas on how I can get this time value from the datetime field in the recordset to set the combo box to the right selection and keep the users locked out of free-form?
Monkeylizard
Sometimes just a few hours of trial and error debugging can save minutes of reading manuals.