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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yes/No Messages Boxes 2

Status
Not open for further replies.

paulbradley

Programmer
Joined
Oct 9, 2002
Messages
158
Location
GB

This is prob quite an easy question to all you VB buffs, but here goes.

I have a form in MSAccess and want a message box with yes and no buttons to appear, with a certain bit of code happening if yes is cliked and a different bit if no is clicked.

I guess it starts MsgBox("blah blah", than what?

Thanks.
 
There are of course several versions. I like the one with

dim iAnswer as integer
iAnswer=MsgBox("Bla bla",vbYesNo,"More lyrics")
if iAnswer=vbYes then
' perform some code here
else
' the other code here
end if

There are several boks types to choose from, you'll see 'emall when you reach the first comma.

Enjoy, Roy-Vidar
 
try this:

Dim msg, Style, Title, Response
msg = "Are you sure ?"
Style = vbYesNo + vbQuestion
Title = "My question"


Response = MsgBox(msg, Style, Title)

If Response = vbYes Then
'your code if answered yes
Else
'your code if answered no
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top