Default button in message box

  • Thread starter Thread starter Paul Fenton
  • Start date Start date
P

Paul Fenton

I'm using the code below in a form control.

Dim mess As String, answer As String
mess = "Are you sure you want to change this?"
answer = MsgBox(mess, vbYesNo, "Subject ID")
If answer = vbNo Then
Cancel = True
Me.Undo
End If

As it stands, the default button is "Yes", but I want it to be "No".
How do I do that?


Paul Fenton
 
I'm using the code below in a form control.

Dim mess As String, answer As String
mess = "Are you sure you want to change this?"
answer = MsgBox(mess, vbYesNo, "Subject ID")
If answer = vbNo Then
Cancel = True
Me.Undo
End If

As it stands, the default button is "Yes", but I want it to be "No".
How do I do that?

Dim mess As String, answer As String
mess = "Are you sure you want to change this?"
answer = MsgBox(mess, vbYesNo + vbDefaultButton2, "Subject ID")
If answer = vbNo Then
Cancel = True
Me.Undo
End If
 
Jeff, thank you so much!

You're welcome, glad to help.
Paul Fenton
Access Struggler

<g>
Come here more often and you won't be!

We're open almost every day of the year.
(We're closed on the last day of each year for Troll fumigation)
 
Back
Top