Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbYESNO programming option question 1

Status
Not open for further replies.

montejr

Programmer
May 24, 2001
42
0
0
US
Is there a way to actually asign code to the vbyesno option. Basically what I want to do is if you choose yes, the cursor goes to my next tab stop. If you choose no, it stays on the current tab stop. Any ideas.

thanks,
monte
 
Here is what I have always used and its straight from the Access help:

Dim Msg, Style, Title, Help, Ctxt, Response, MyString

Msg = "Do you want to continue ?" ' Define message.

Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.

Title = "MsgBox Demonstration" ' Define title.

Help = "DEMO.HLP" ' Define Help file.

Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)

If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
<**insert your code here if the user clicks yes**>
Else ' User chose No.
MyString = &quot;No&quot; ' Perform some action.
<**insert your code here if the user clicks no**>
usually, if you just want to cancel the current action, I just put a number 2 for cancel
End If

Also, if you just want to do a simple msgbox in the future, you can do this: msgbox &quot;You cant do that here&quot;,vbOkOnly + vbInformation,&quot;msgbox title goes here&quot;

When you start the msgbox, it will give you intellisense and show you what goes where, just follow along and BAM, you want fries with that?

Take out what you dont need and you can customize your buttons in the Style above.. msgbox help in Access has more information as well..
 
Thank you very much. That is exactly what I needed.
cheers,
monte
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top