Message Box

  • Thread starter Thread starter Luther
  • Start date Start date
L

Luther

Hi,

How would I put a message box that would give me both [OK]
and [CANCEL] buttons so the user can choose not to run
that particular function if they choose. I have set the
warnings off and wanted to put my own message. Any ideas,
please? By the way, this function calls for a query to run.
 
Try something along the lines of

If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
End If

Hope This Helps
Gerald Stanley MCSD
 
Thanks a lot, Gerald. Am I to assume that, by default, if
you specify some action for OK, then Cancel will have the
opposite and abort the process?
-----Original Message-----
Try something along the lines of

If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
End If

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Hi,

How would I put a message box that would give me both [OK]
and [CANCEL] buttons so the user can choose not to run
that particular function if they choose. I have set the
warnings off and wanted to put my own message. Any ideas,
please? By the way, this function calls for a query to run.
.
.
 
As the 2nd parameter into the Msgbox function specifies
only two buttons (Ok and Cancel), you can use a standard If
Then Else construct to code for either button being
clicked. So, if there is specific actions that you wish to
follow if the Cancel button is clicked, the code would look
like
If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
Else
code to cancel the action
End If

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Thanks a lot, Gerald. Am I to assume that, by default, if
you specify some action for OK, then Cancel will have the
opposite and abort the process?
-----Original Message-----
Try something along the lines of

If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
End If

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Hi,

How would I put a message box that would give me both [OK]
and [CANCEL] buttons so the user can choose not to run
that particular function if they choose. I have set the
warnings off and wanted to put my own message. Any ideas,
please? By the way, this function calls for a query to run.
.
.
.
 
Thank you, Gerald. Most helpful.
-----Original Message-----
As the 2nd parameter into the Msgbox function specifies
only two buttons (Ok and Cancel), you can use a standard If
Then Else construct to code for either button being
clicked. So, if there is specific actions that you wish to
follow if the Cancel button is clicked, the code would look
like
If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
Else
code to cancel the action
End If

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Thanks a lot, Gerald. Am I to assume that, by default, if
you specify some action for OK, then Cancel will have the
opposite and abort the process?
-----Original Message-----
Try something along the lines of

If MsgBox("Do You Want to Run The Query", vbOkCancel) =
vbOk Then
code to run the query
End If

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Hi,

How would I put a message box that would give me both [OK]
and [CANCEL] buttons so the user can choose not to run
that particular function if they choose. I have set the
warnings off and wanted to put my own message. Any ideas,
please? By the way, this function calls for a query to run.
.

.
.
.
 
Back
Top