Hi,
I have a form with several comboboxes which should only accept values from the list. I have set the NotInList event, but in addition I added these two modules, which should fire on entering the combobox and on Keypress:
Private Sub ucbo_Starter_Enter()
sOldValue = ucbo_Starter
If Len(Nz(ucbo_Starter)) <> 0 Then Exit Sub
If ucbo_Starter.Locked = True Then Exit Sub
Call fEnterControl("full composition"
End Sub
Private Sub ucbo_Starter_KeyPress(KeyAscii As Integer)
If KeyAscii = 9 Or KeyAscii = 13 Then Exit Sub
MsgBox "You can not change entries in this combo box manually." & vbCr _
& "Please select an item from the dropdown list."
ucbo_Starter = sOldValue
End Sub
It is my understanding that, if the user presses a key except tab or enter, e.g. "b", after the message the original entry should re-appear in the combobox. However, it shows "b".
If I set a breakpoint in the second module, the original entry appears as wished.
Any experience here what I'm doing wrong?
Thanks for any tip. georgp
I have a form with several comboboxes which should only accept values from the list. I have set the NotInList event, but in addition I added these two modules, which should fire on entering the combobox and on Keypress:
Private Sub ucbo_Starter_Enter()
sOldValue = ucbo_Starter
If Len(Nz(ucbo_Starter)) <> 0 Then Exit Sub
If ucbo_Starter.Locked = True Then Exit Sub
Call fEnterControl("full composition"
End Sub
Private Sub ucbo_Starter_KeyPress(KeyAscii As Integer)
If KeyAscii = 9 Or KeyAscii = 13 Then Exit Sub
MsgBox "You can not change entries in this combo box manually." & vbCr _
& "Please select an item from the dropdown list."
ucbo_Starter = sOldValue
End Sub
It is my understanding that, if the user presses a key except tab or enter, e.g. "b", after the message the original entry should re-appear in the combobox. However, it shows "b".
If I set a breakpoint in the second module, the original entry appears as wished.
Any experience here what I'm doing wrong?
Thanks for any tip. georgp