Adding data via a subform

stemar

Board Regular
Joined
Mar 16, 2002
Messages
248
I have, amongst other tables, Contractors with details such as name, address, etc. Jobs, a list of different types of jobs and a third called Contractors and Job Types, linking each contractor's name and the type of jobs they do.

In a form for Contactors I have a sub-form with a list of the types of jobs they do, drawn from Contractor and Jobs. If I try to add a type of job to the subform, when I close the form, I get an error "You cannot add or change a record because a related record is required in table 'Contractors'"

What I want to be able to do is add a job type to the subform and have an entry appear in the Contractors and Job Types table linking the new job type to the contractor on the form.

Can anyone help please?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I believe if you "link" these two tables in Relationships, and select the "Cascade Update Related Fields" option, it should work. Just make sure that in your subform, you are entering all the necessary Primary Key fields, so Access can create a new, unique record.
 
Upvote 0
You've got a Many-to-Many relationship going here... Don't know for sure, ignore if I'm wrong but are you relating Contractors directly to Job Types?
It should be Contractors --- Jobs --- Job Types, with the outer tables both linked One-to-Many to the join table. The form should then be based on Jobs, using combos to pick Contractors and Job Types.

If this is unclear, or if I have totally missed the point :p , paste back for help.

HTH
Denis
 
Upvote 0

Forum statistics

Threads
1,221,569
Messages
6,160,557
Members
451,656
Latest member
SBulinski1975

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