Delete button that deletes record from database

tankertert

New member
Local time
Today, 08:34
Joined
Sep 22, 2012
Messages
7
Hi guys.

Im very new to Access, so theres a lot i dont know.
I've currently got a form that has a combo box, some text boxes, and a delete button on it.
I've managed to get the textboxes to autofill based on what the user selects from the combo box, but im stuck with how to go about deleting that record.

At current, my delete button was set up through Button wizard, and when pressed, only deletes the record from the textboxes on the form (clearing the form). What i want it to do is actually delete that entire record from the table that the form is based upon. I just have no idea of what the code i should put behind the button is.

Sorry if that makes no sense. Basically, all i want is a button that when pressed, deletes the record that the user has selected from the combo box, from the table that the record came from.

Thank you for any help!
 
Show us the vba code for the Delete Button's Click event.
 
There's nothing in the vba code at the moment. All the wizard does is give me a button that "clears" the form.
 
I found this code, and have it implemented in the "onClick" tab, but it doesnt delete the record.

Private Sub Command21_Click()
DoCmd.RunCommand acCmdDeleteRecord
End Sub

But it doesnt delete the record from the database
 

Users who are viewing this thread

Back
Top Bottom