Need to create a form to enter a record ID to delete

I have a table called “SBOD”. I want a simple form that just contains the record Id field (ID) to enter and when pressing enter or a button it deletes that record. ID is the system assigned unique key.

Im brand new to base and would love any help with this. If I get an answer in SQL I know how to run it in base.

Thanks in advance

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.

I will try the standard filter option on the table view. To be honest you lost me on the rest :slight_smile:

Ill check that post out. I would like the option in a form to enter ID, bring up the record to visually see its the correct one, then use the navigation pane to remove it.

If you could give me more detail on form option that would be great!

Thanks for the reply

@brhanson2 Be sure to get sample from last post. Original wasn’t good.