Msgbox constants

arage

Registered User.
Local time
Today, 11:26
Joined
Dec 30, 2000
Messages
537
Msgbox constants
A vbYesNoCancel messagebox has a value of 3. But what does this value represent, just that the button was pressed? Because that’s what I’m finding out. I would however like to get my hands on the value that indicates WHICH button was pressed, YES, NO or CANCEL.

I thought message box return values 6, 7 and 2 were what was returned when the appropriate button was pressed on the vbYesNoCancel button, obviously that isn’t the case though. Please advise.
 
from the same help you read:

The first group of values (0–5) describes the number and type of buttons displayed in the dialog box; the second group (16, 32, 48, 64) describes the icon style; the third group (0, 256, 512) determines which button is the default; and the fourth group (0, 4096) determines the modality of the message box. When adding numbers to create a final value for the buttons argument, use only one number from each group.

_________________________________

To fiund out which number a constant represents try putting a bookmark on the code and hover your mouse over the vbYes to find out it's avlue etc...

Ian
 
i came up with this, thanks for your help!

Private Sub cmdEmail_Click()

Dim intResult As Integer ' yesNoCancel...

intResult = MsgBox("You are about to submit this subscription information. Are you sure? (Be sure you're connected to the internet and that Outlook is on.)", vbYesNoCancel, "Email")

'don't submit email...
If intResult = vbNo Or intResult = vbCancel Then '6/7/3...
Exit Sub
Else
intResult = MsgBox("Email a copy to the subscriber as well?", vbYesNo, "Email")
End If

'send email...
If intResult = vbYes Then '6/7...
'don't submit email if email missing...
If IsNull(Me.txtEmail) = True Or Me.txtEmail = "" Then
MsgBox "Fill in the subscriber's email address.", vbCritical, "Error"
Me.txtEmail.SetFocus
Exit Sub
End If
DoCmd.SendObject , , , "PreRegistrations@Satellite.Com", Me.txtEmail, , "Subscriber Pre-Registrations", , True
Else
DoCmd.SendObject , , , "PreRegistrations@Satellite.Com", , , "Subscriber Pre-Registrations", , True
End If
End Sub
 
Values of msgboxs

1 = OK; 2 = Cancel; 3 = Abort; 4 = Retry; 5 = Ignore; 6 = Yes; 7 = No

hope helps
 

Users who are viewing this thread

Back
Top Bottom