Query with Form Selections

MakinBacon91

New Member
Joined
Sep 8, 2015
Messages
47
Hello All,

I am trying to build a User Form that will not let the user get an error saying "You cannot add or change record because a related record is required in table '...'"

Here is a picture of the form I am trying to build: Pasteboard — Uploaded Image

The user enters Customer, Set Number, and Engine.
Then, based on the Engine I want the Stage "Combo Box" to populate with the stages available for that engine.
The user could then pick a stage, and it would populate the Component "Combo Box" based on the engine and stage that was selected.

Any thoughts?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
It looks like you have two tables. The Main-Table for Engine and the child table:Stages, related to the Primary-Key field Engine-Table.

1. If you try to change the Foreign Key in the Stages table - related to the primary key in Engine-Table - then Access will not allow it (without changing the primary key in the engine table first).
2. If you are trying to enter a new record in the Stages Table; without entering the main record in the Engine-Table, with the same primary-key value, then Access will not allow you to do that either.

If these are the two issues you are facing then hope that it is clear to you now. Go through the Relationship topic in the Microsoft Access Help Documents.
 
Upvote 0
instead of a query with both tables, make a mainform based on the main table

make another form based on the Stages table. be sure EngineID is also on this form.

Then drag the stages form to the design view of the engines form to create a subform. LinkMasterFields = LinkChildFields = EngineID

WHERE
EngineID is the primary key for the main table. If different, change this to the primary key
In the related table, EngineID (or the PK) will be a foreign key
 
Upvote 0

Forum statistics

Threads
1,221,832
Messages
6,162,255
Members
451,757
Latest member
iours

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