Greetings. I am doing an app with a form that allows for a user to enter a maximum of 2 records. It has a combobox (combobox1) with 5 values that go in a Type field - a, b, c, d, e). There are rules about whether certain values can be selected based on whether the other record value for Type. One example of a rule might be to not allow selection of 'a' if the other record has b, d, or e in the type.
My plan is to use the event like below which I am using for other controls to ensure the proper data entry (numeric, date, etc.) which works fine on other controls.
A decision prompt will appear with the a Proceed and Cancel buttons. It is possible that I get into a scenario where an update to a record would require an update to the other record, putting the user in a situation where neither record could be updated without simultaneously updating the other record. The Proceed button would be an "approval" to reset the type on the other record.
My problem is that the ControlValidate function - which I am using successfully on textbox validation - does not fire unless I tab away, or select one of the buttons. I don't want to let the user move off of the combobox until a valid selection is made. Most of the event do not allow the "ByVal Cancel..." arguments. I have tried this with option buttons, but still have the same issue capturing the beforeupdate event.
I have spent many, many hours trying to consider another plan. How can I go about doing this?
I have cross posted here:
My plan is to use the event like below which I am using for other controls to ensure the proper data entry (numeric, date, etc.) which works fine on other controls.
VBA Code:
Private Sub comcbobox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
CheckFor = ActiveControl.Value
Cancel = Not ControlValidate(CheckFor)
End Sub
A decision prompt will appear with the a Proceed and Cancel buttons. It is possible that I get into a scenario where an update to a record would require an update to the other record, putting the user in a situation where neither record could be updated without simultaneously updating the other record. The Proceed button would be an "approval" to reset the type on the other record.
My problem is that the ControlValidate function - which I am using successfully on textbox validation - does not fire unless I tab away, or select one of the buttons. I don't want to let the user move off of the combobox until a valid selection is made. Most of the event do not allow the "ByVal Cancel..." arguments. I have tried this with option buttons, but still have the same issue capturing the beforeupdate event.
I have spent many, many hours trying to consider another plan. How can I go about doing this?
I have cross posted here:
Forcing a combobox selection validate against other data
Greetings. I am doing an app with a form that allows for a user to enter a maximum of 2 records. It has a combobox (comcbobox1) with 5 values that go in a Type field - a, b, c, d, e'). There are rules about whether certain values can be selected based on whether the other record value for Type...
www.excelforum.com