Help with interface Allowing a User to Delete a Record

W

wolfpack

How do I go about allowing a user to delete a record from a table. Here is
my situation.

I have a main menu with command buttons. One of the button reads "Remove
Reviewer". Right now the buttton does nothing.

What I would like is when it is clicked to have a window open that allows
the user to select a name (drop down menu I suppose) from the "reviewers"
table. Once the name is selected I would like for the user to click on a
button that says "Remove this Reviewer". Once this happens, the reviewer
would be removed from the table along with any other info in that row.

Thanks for the help and I apologize if this is not in the correct section.
 
D

Danny J. Lesandrini

There are many steps involved here. Which one(s) do you need help with?

You need to
1) create a form and have it opened by the button click on the menu
2) add a combo box and load it with names
3) execute the delete to a number of tables.

Assuming you can create the form and combo box, the delete could happen
in a number of ways.

If you have cascading deletes enabled, you need only delete the parent row
and all child records will be swept away with it. If not, then you need to perform
a series of deletes on the tables in proper order, something like this ...



Dim lngID As Long
Dim sSQL As String

lngID = Me!cboReviewier.Column(0) ' if column 0 has your ID value

sSQL = "DELETE FROM tblReviewerChildsChild WHERE ID = " & lngID
CurrentDb.Execute sSQL

sSQL = "DELETE FROM tblReviewerChild WHERE ID = " & lngID
CurrentDb.Execute sSQL

sSQL = "DELETE FROM tblReviewer WHERE ID = " & lngID
CurrentDb.Execute sSQL

' Requery the combo box to reflect the data changes just applied
Me!cboReviewer.Requery

Does this help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top