One To Many Relationships

Forgive me; but I'm extremely new to Access.  I've created a Table "T-Customer" and have the Key as "CustomerID" and have created a table called "Inventory" with an "InventoryID".  From these tables, I've created a Query with a One-To-Many relationship "One" Customer to "Many" Inventory and then have created a Master Form with Customers and a Subdatasheet with Inventory.  When I click on "Add Inventory", a child form pops up- but doesn't automatically populate the "CustomerID" in the Child Form.  I just need to know how to make this happen and I'm afraid I'm overthinking it...
Sara HedtlerInsurance DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kelvin SparksCommented:
Have you set the parent and child properties of the subform (on the data property tab)?
This should manage it for you.


Kelvin
Kelvin SparksCommented:
Normally you wouldn't display the parent ID, and just Access manage this in the background
Sara HedtlerInsurance DirectorAuthor Commented:
I apologize Kevin, but I'm not quite sure what you mean?
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Sara HedtlerInsurance DirectorAuthor Commented:
The inventory form actually is an actual policy list; hard to explain- but each is different.  So I gave them Keys as they may have to be edited.
Kelvin SparksCommented:
OK, I may have misunderstood how you've designed your forms - using subdatasets (which I have never used) rather than subforms. With a subform, you define the parent/child relationship so that the sunform inherits the ID of the parent form automatically. This is a property of the subform (I assume that a subdataset also has properties). Once this is set, Acess will manage that for you.


Kelvin
Sara HedtlerInsurance DirectorAuthor Commented:
Probably no real way to understand my madness!  The main form does have a subform that outlines the "Jist" of the other form.  Is there a way I can send it to you?  I'm sure if you could see it, it would make sense.
Kelvin SparksCommented:
You should be able to upload it here
Sara HedtlerInsurance DirectorAuthor Commented:
I just sent it via email on here.
Kelvin SparksCommented:
Replied, although you should always post examples etc here rather than as a message to an individual
Sara HedtlerInsurance DirectorAuthor Commented:
I've attached a slimmed down version.  PLEASE remember, I'm so new to this.  I'm sure I've made some errors.
ACCESS-PROJECT.accdb
Kelvin SparksCommented:
Looking at F_ClientSetup, you've correctly set the Parent Child.
Did you try closing and reopening to see if the ClientID was populated afterward. I don't think it is, until Access saves the record (after you move off it - or close the form.

Kelvin
Kelvin SparksCommented:
Generally, you wouldn't add this column onto the form - there's no point in seeing it (other than to add to your anxiety). You will know it from the parent (if you need it at all). I prefer to leave it off, or at least make it non visible so as not to confuse people.


Kelvin
Sara HedtlerInsurance DirectorAuthor Commented:
I did?  YAY!!!  I did close out of the form, closed out of access and then went back in and it didn't work.  I also did the [Forms]![F-ClientSetUp]!ClientID and its working short term.
Sara HedtlerInsurance DirectorAuthor Commented:
So if I leave it off both forms, how would the child form be affected?  Because the Child form is extremely specific to the parent form.
Kelvin SparksCommented:
The clientID is in the forms data source, so Access knows. It doesn't have to be on the form. I often leave it there, but set its visible Property to No, so you don't see it.


Kelvin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.