Message Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which asks the user to check a box if certain conditions apply.
If the box is checked then they have to fill in another text box with the
details of that condition. To keep the user from filling in information in
the details section and not checking the box, I have the text box for the
details disabled. Once the user checks the check box, a macro runs which
enables the details section. Similarly, if the user unchecks the checkbox, I
have a macro that sets the text box to null and disables it again. What I
want to do is to provide the user a warning message if they uncheck the check
box which tells them that any data typed in the details section is about to
be erased, thereby giving them a chance to cancel the action. Can someone
tell me how to create a message box that gives the user choices and then
performs actions based on those choices. Thanks.
 
I have a form which asks the user to check a box if certain conditions apply.
If the box is checked then they have to fill in another text box with the
details of that condition. To keep the user from filling in information in
the details section and not checking the box, I have the text box for the
details disabled. Once the user checks the check box, a macro runs which
enables the details section. Similarly, if the user unchecks the checkbox, I
have a macro that sets the text box to null and disables it again. What I
want to do is to provide the user a warning message if they uncheck the check
box which tells them that any data typed in the details section is about to
be erased, thereby giving them a chance to cancel the action. Can someone
tell me how to create a message box that gives the user choices and then
performs actions based on those choices. Thanks.

Code the CheckBox BeforeUpdate event:

If MsgBox("Are you sure you want to do this?",vbYesNo) = vbNo Then
Cancel = True
Else
'Do the yes thing here"
End If
 
Back
Top