Responding to a message box

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

Guest

I have a message box that pops up on the screen in the occurance of a certain
event. The message box has two buttons YES and NO. I want when the user
clicks on NO to set the focus on a field in the form and when clicking on YES
to close the form. How to assign this to the 2 buttons on the msgbox???
 
I have a message box that pops up on the screen in the occurance of a certain
event. The message box has two buttons YES and NO. I want when the user
clicks on NO to set the focus on a field in the form and when clicking on YES
to close the form. How to assign this to the 2 buttons on the msgbox???

If MsgBox("Your message here", vbYesNo) = vbYes then
'Do the yes thing here
DoCmd.Close acForm, Me.Name
Else
' Do the No thing here
[ControlName].SetFocus
End If
 
Back
Top