BirdMan
BirdMan

Reputation: 171

How to remove a specific Record from a Table that is selected in a "subform"?

My DB allows users to add New Material Numbers (only one column). These numbers are stored/appended to a table. I use a Subform to display them back to the user for visibility.

Sometimes user may input an incorrect Material Number. Current process is manually removing from the table. I need to provide an automated option to remove this record from the table.

Steps:
1. User must SELECT a record from the Subform.
2. Press button to remove, which will remove the selected record from the table

My challenge is capturing the selected item from the table.
table = tblMaterial
subform = subfrmMaterial

Any support is appreciated.

Upvotes: 0

Views: 35

Answers (1)

June7
June7

Reputation: 21379

Options:

  1. user can use keyboard Delete

  2. code runs DoCmd.RunCommand acCmdDeleteRecord

  3. code runs SQL action DELETE FROM tblMaterial WHERE ID=" & Me.MaterialID

Upvotes: 1

Related Questions