Update Query Command Button

Lamb2087

Registered User.
Local time
Today, 11:41
Joined
Feb 7, 2003
Messages
103
How would I make a command button that would run an update query. In the command button wizard I did not see anything that would do this. Can some one tell me the code to put in on the VB side to make this work. Query called: UpdateRiflesQuery
 
Dialog Box

Hayley:
What code could I put in the vb side that will give the user the option of yes proceed or no do not proceed.

Thanks In Advance!
 
cmdButton_OnClick()

Dim Response as Integer

Response = MsgBox("Do you wish to continue?", vbYesNo, "Update Query")

If Response = vbNo Then 'User chose no
Exit Sub
Else 'User chose yes
End If

Let me know if that's ok for you, if not I can maybe send you a little something to look at.
 
Here is the delete code

Hayley:
Here is the code generated by the wizard to run the query. Do I substitute what you sent me?

Private Sub cmdDCadets_Click()
On Error GoTo Err_cmdDCadets_Click

Dim stDocName As String

stDocName = "DeleteCadetIdQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_cmdDCadets_Click:
Exit Sub

Err_cmdDCadets_Click:
MsgBox Err.Description
Resume Exit_cmdDCadets_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom