A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

pop up box



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 12:03 AM
Dan
external usenet poster
 
Posts: n/a
Default pop up box

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.
  #2  
Old May 27th, 2004, 12:37 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default pop up box

Dan,

Is there something you don't like about the MsgBox?
Debug.Print MsgBox("blah blah", vbYesNo+vbQuestion, "MyDialog")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"Dan" wrote in message
...
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.



  #3  
Old May 27th, 2004, 02:44 AM
tina
external usenet poster
 
Posts: n/a
Default pop up box

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


"Dan" wrote in message
...
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.



  #4  
Old May 27th, 2004, 03:33 PM
Dan
external usenet poster
 
Posts: n/a
Default pop up box

That works great, just one question. How do you capture
what button is clicked?
  #5  
Old May 27th, 2004, 05:34 PM
Jim/Chris
external usenet poster
 
Posts: n/a
Default pop up box

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

-----Original Message-----
That works great, just one question. How do you capture
what button is clicked?
.

  #6  
Old May 28th, 2004, 12:52 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default pop up box

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/WileyT...764559036.html


"Dan" wrote in message
...
That works great, just one question. How do you capture
what button is clicked?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.