Full Version: Deleting from Multiple Tables Using One Form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Chris_K
Hi all,

Let me explain what I'm doing and then what I can't figure out.

I have a formA that the user will enter data into, lets say a name and phone number which is stored on TableA. On this formA I have multiple checkboxes for different criteria. If the user checks the box marked "Address" it will open up a new formB that has fields for all the necessary data the user needs to input that it will store on TableB.

What I want to do is if the user wants to delete an entry from TableA using formA, I want it to delete the corresponding address in TableB.

After writing this, it sounds like it could be solved with relationships. However I don't know how to use them very well so if thats the case please point me in the right direction.


Thanks
theDBguy
Welcome to UA!

You are correct that you'll need to establish the relationship between TableA and TableB. Look up "Referential Integrity" in Access Help. HTH
Chris_K
I'm going to be more specific to my database and maybe somebody can suggest something to me that I might be missing because I can't figure out how to get the relationships to do what I want.

After clicking "Add Equipment" a form opens up that lists six different checkboxes with names of groups in my department. For example. If you are part of the Civil group you will click the "Civil" checkbox. This opens up formA from my previous post. There are three text fields and 6 more checkboxes. One text field is automatically filled with what you clicked from the previous form. The user then gives the equipment a description and a tag number meaningful to their group in the other two boxes.

The checkboxes on this form are the same six as before. Now lets say the civil group added a part that needs electricity. They will click the electrical box and formB from my previous post will open up. The group number and description is auto filled again and the user then enters info such as "Volts", "HP", "kW", etc. User clicks "Done" and is returned to formA to either go to another disicpline or enter another part.

As stated before, when I delete a part in formA I want the information they entered in the other form such as "volts" to be deleted as well.

Right now I've only got two tables, the main parts table, and the electrical table, just to use to figure this out. I will be adding at least 5 more tables, if that matters. I do not have a primary key in either table and tried creating PK's in each table that used autonumbers to relate the main table to the electrical. That did not work out and am completely lost on how to do this. I have tried going through tutorials in the past, but have had no success. I'll keep searching for ways to figure this out.

What I'm hoping for at this point I guess is any advice in case someone notices something fundamentally wrong with my design or ideas.

Sorry for such a long post, but I'm just trying to get any and all advice I can.

Thanks in advance for your time.
Chris_K
Got it. Being a noob I just want everything to work without putting in the effort!

thanks for the tip DBguy
theDBguy
You're welcome. Doing it the right way means less work for you. With Referential Integrity turned on, Access will take care of the cleanup for you (both Cascade Delete and Cascade Update). Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.