P
Paul Ponzelli
I would like to have the user confirm any change in a combo box, and I'm
trying to use the Before Update event for this purpose, as shown in the code
below. However, there is something wrong with this code, because regardless
of whether the user selects 'Yes' or 'No', the combo box accepts the new
value.
How should I change the code below so that if the user clicks 'Yes' the
change is accepted, and if the user clicks 'No' the control reverts to the
previous value?
Private Sub InstutionType_BeforeUpdate(Cancel As Integer)
Dim response As Integer
response = MsgBox("Do you want to change the Type to the one you selected?"
& vbCr & vbCr & _
"Click 'Yes' to change the type, 'No' to keep the existing type.",
vbYesNo + vbInformation, "Institution Type changed")
If response = vbYes Then
Cancel = False
ElseIf response = vbNo Then
Cancel = True
End If
End Sub
Thanks in advance,
Paul
trying to use the Before Update event for this purpose, as shown in the code
below. However, there is something wrong with this code, because regardless
of whether the user selects 'Yes' or 'No', the combo box accepts the new
value.
How should I change the code below so that if the user clicks 'Yes' the
change is accepted, and if the user clicks 'No' the control reverts to the
previous value?
Private Sub InstutionType_BeforeUpdate(Cancel As Integer)
Dim response As Integer
response = MsgBox("Do you want to change the Type to the one you selected?"
& vbCr & vbCr & _
"Click 'Yes' to change the type, 'No' to keep the existing type.",
vbYesNo + vbInformation, "Institution Type changed")
If response = vbYes Then
Cancel = False
ElseIf response = vbNo Then
Cancel = True
End If
End Sub
Thanks in advance,
Paul