Need help with code

  • Thread starter Thread starter Lasse T
  • Start date Start date
L

Lasse T

A simple one for most of you.

Could someone please provide me with a code that creates a message box with
two buttons, yes and no.
The "no" button stops and return to the form and the "yes" button continues.

Thanks in advance.

Lasse T
---------------
 
"Lasse T" said:
A simple one for most of you.

Could someone please provide me with a code that creates a message box with
two buttons, yes and no.
The "no" button stops and return to the form and the "yes" button continues.

Thanks in advance.

Lasse T
---------------

Lasse

If you are running the code from a Command Button's OnClick event, then you can
use something like:

Private Sub Command2_Click()
If vbYes = MsgBox("Please press either Yes or No", vbYesNo, "??") Then
' Carry on with code
Else
' Don't process any more code
End If
End Sub
 
Lasse said:
A simple one for most of you.

Could someone please provide me with a code that creates a message box with
two buttons, yes and no.
The "no" button stops and return to the form and the "yes" button continues.

Thanks in advance.

Lasse T
Lasse,
Where are you doing this?
In a Control's BeforeUpdate event perhaps?

Dim intResponse as Integer
intResponse = MsgBox("Your message here",vbYesNo)
If intResponse = vbNo Then
Cancel = True
End If
End Sub
 
Thanks a lot. It works just fine.
Seems I need to start learning some VBA soon :-)

Lasse T
--------------
 
Back
Top