Yes / No default to No

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

Guest

How do I get the default to be "No" on this Message Box with Yes and No
Options?

Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:=Trim(Str(vCount)) + " Records already posted.
Continue with append?", Buttons:=vbYesNo)

' If statement to check if the yes button was selected.
If Response = vbYes Then

DoCmd.OpenQuery "AddEntries"

End If


Thank you,

Steven
 
How do I get the default to be "No" on this Message Box with Yes and No
Options?

Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:=Trim(Str(vCount)) + " Records already posted.
Continue with append?", Buttons:=vbYesNo)

' If statement to check if the yes button was selected.
If Response = vbYes Then

DoCmd.OpenQuery "AddEntries"

End If

Thank you,

Steven

dont think you can...you could preset it...
intResponse=vbNo
intResponse=MsgBox("some prompt...")
 
But if the button default were still Yes, then wouldn't that override the
preset No in the second assignment?
 
Steven said:
How do I get the default to be "No" on this Message Box with Yes and No
Options?

Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:=Trim(Str(vCount)) + " Records already posted.
Continue with append?", Buttons:=vbYesNo)

' If statement to check if the yes button was selected.
If Response = vbYes Then

DoCmd.OpenQuery "AddEntries"

End If
Thank you,

Steven

use the vbDefaultButton2 constant
Buttons:=vbYesNo + vbDefaultButton2

Fred
 
Back
Top