VbYesNo If yes then run update query

hullstorage

Registered User.
Local time
Today, 00:50
Joined
Jul 18, 2007
Messages
213
Hi all,

Brain a bit rusty.

I have a form with command button and want to dipslay message

Are you sure you want to update the following records

then if user selects yes this will run the update query then if no
then simply cancel the event

thanks

simon
 
If msgbox("Are you sure you want to update the following records?",vbOkCancel) = vbOk Then
DoCmd.RunSQL "Your code here"
Else
Cancel = true

End if

Try that!! :) (or some form there of)
 
If msgbox("Are you sure you want to update the following records?",vbOkCancel) = vbOk Then
DoCmd.RunSQL "Your code here"
Else
Cancel = true

End if

Try that!! :) (or some form there of)

Actually, if you want yes/no then
Code:
If MsgBox("Are you sure you want to update the following records?", vbYesNo, "Update?") = vbYes Then
   CurrrentDb.Execute "SQL String Here"
End If

No need for Cancel = True in this case.
 

Users who are viewing this thread

Back
Top Bottom