Userform combobox matchrequired = True; error with no selection
It would be easier to offer a suggestion if the CombBox code wast posted.
However, one way to handle it is to create a handling loop where a message
box is generated when the selection is made and the ComboBox event is
triggered. As an example, if you are using the click event:
Private Sub ComboBox1_Click()
dblChk = MsgBox("Are you sure you want to select " & _
Me.ComboBox1.Value, vbYesNo + vbQuestion, _
"CONFIRM SELECTION")
If dblChk = vbNo Then
Me.ComboBox1.Value = -1
Exit Sub
Else
'Your current code here
End If
End Sub
The object is to reset the ComboBox to empty without triggering any other
event.
"ker_01" wrote in message
...
I have a userform that includes a combobox which is optional for the user,
but if they do use it, they have to select one of the three values
provided
(no creativity allowed).
This works fine if the user ignores the field, or if they make a
selection.
They can even click the combobox 'arrow' to see the values and then click
to
another part of the form without making a selection. They can tab through
controls including this one without any problem. All good.
However, a user may enter the field (mouseclick) thinking they might want
to
make a selection, then decide against it. In those cases, they should be
able
to click on another control, tab away, or click the submit or cancel
commandbuttons on the form without error.
However, the actual behavior is that once the combobox field is entered by
the cursor via a mouse click, a selection is required. Attempting to leave
the combobox without a selection results in the error "Microsoft Forms:
Invalid property value"
Is there a different way to set up the combobox that avoids this error? I
do
not want to offer the user a "blank" value, because after making a
selection
they are not allowed to remove it (they can change it to another of the
three
values, they just aren't allowed to blank it out again). I'd be happy if
there was a way to block the mouse from selecting (setfocus?) within the
combobox as long as they could still select the combobox downarrow and
select
a value from there.
Thank you,
Keith
|