pop up box

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I just need a pop up box, like a message box, but instead
of just selecting ok I need to be an option box where you
can select yes or no. It would be excellent if you could
edit what the commands says instead of yes/no. I just
plan on having this execute every time a form in closed.
 
you can set the Msgbox() function to show multiple buttons: Yes/No,
Ok/Cancel, Retry/Cancel, and Yes/No/Cancel. if you want other button labels,
i believe you'll have to build your own "pop-up" form to suit your needs.
when you use a multi-button message box, you have to include additional
coding to handle the user's "choice", of course.

hth
 
You could try something like this.

Dim strMessage As String
strMessage = "Do you want to do something?"
If MsgBox(strMessage, vbYesNo) = vbYes Then
MsgBox "You clicked yes", vbOKOnly
Else
MsgBox "You clicked no", vbOKOnly
End If

Jim
 
Dan,

The return value depends on which buttons are displayed. If you specify
vbOK, then that's what you test for, and if you specify vbCancel, then test
for vbCancel.

Even if you specify multiple buttons, for example, vbYesNoCancel, you can
test for vbYes, vbNo and vbCancel individually. The following is a typical
example:
Dim iReturn As Integer

iReturn = MsgBox("blah blah", vbAbortRetryIgnore + vbCritical, "my
Custom MsgBox")
Select Case iDigit
Case vbAbort
Case vbRetry
Case vbCancel
End Select

You can also do it this way:
Select Case MsgBox("blah blah", vbAbortRetryIgnore + vbCritical, "my
Custom MsgBox")
Case vbAbort
Case vbRetry
Case vbCancel
End Select

....and this way...
If vbYes = MsgBox("blah blah", vbYesNo, "my Custom MsgBox") Then

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
Back
Top