Ask Your Question
0

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

asked 2018-06-02 20:53:25 +0200

brhanson2 gravatar image

updated 2018-06-02 21:07:08 +0200

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-06-02 23:03:21 +0200

Ratslinger gravatar image

updated 2018-06-03 04:23:27 +0200

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 ----- C:\fakepath\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.

edit flag offensive delete link more

Comments

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

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 gravatar imagebrhanson2 ( 2018-06-02 23:18:42 +0200 )edit

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

Ratslinger gravatar imageRatslinger ( 2018-06-03 04:26:13 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-06-02 20:53:25 +0200

Seen: 50 times

Last updated: Jun 03 '18