Command Button to DELETE from 2 tables

bt_user

New Member
Joined
Aug 13, 2003
Messages
12
Hi,

I am sure this is super easy to most people, so be patient with me. :biggrin:

I have a form that references 2 tables (form within a form). The main form references the Contact Info of an employee (tblContact_Info). The subform references which team or teams this employee is on (tblLookup_UserTeam). All the records are tied together by the UserID. tblContact_Info will only have 1 entry with the UserID. tblLookup_UserTeam could have one or multiple records with the UserID.

I would like to put a command button on the main form to "Delete Record". So if an employee is no longer needed in the database, I could click this button and Delete the Employee's Contact Info from tblContact_Info, as well as any and all records associated with that employee's UserID in tblLookup_UserTeam.

What code would I need to associate with this command button?

THANK YOU!!!! :biggrin:
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
If you set up the relationships in the relationship window you can tell access to encorce referential relationships. If you then select to "Cascade Delete Related Records" Access will automaticaly delete all of the child records when you delete the parent record.

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,872
Members
451,674
Latest member
TJPsmt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top