Hello,
The question as stated would produce something on the side of dangerous. If you enter a valid ID & have a delete button, the record is gone. What if the ID was either entered wrong or was the wrong one entered?
The easiest way to do this is right from the table view. Double click on the table to bring up the view. Select Standard Filter
icon on toolbar, choose field (yours is ID), condition is =
and value is ID number. Hit enter. Record is shown if found and empty record if not found. Now if this is the record you want, right click the leftmost box on that row (not one of the fields) & select delete.
Now if really you want to do this on a form, you should still obtain the record first to insure it is the correct one. You can do this with filtering. For a detailed explanation on this, see this post → Filter/Search with Forms (leveraging SubForms). Once retrieved you can delete from the Navagation control or insert a button with the property Action
set to Delete
(on General tab of the controls’ property).
Edit 2018-06-02:
Attached is a Q&D sample based on filtering. One form. View table to get valid id #'s. When selected you can delete using button or Navigation bar ( it’s the red x
).
Sample ----- BikeDemo3.odb
The main form is connected to the table FILTER
. This is nothing more than a one record table to store values in. Then the subform is linked to the mainform (see properties of sub form). The button (Obtain Record) has an action property to refresh form. It is actually located on the sub form. The other button is described above. All this is a basic part of the link above.
Learn filtering. It is very handy. Have posted many variations in this forum.