Combo box to set value in table

I have 2 tables Monitor and Mileage.  Created Form and subform to use combo box to show mileage for one particular monitor.  Works fine.  When I open the form the form shows the combobox, allows me to choose which monitor and then show only that monitors mileage.  
Problem comes when I attempt to add new mileage to that monitor I get following message "The Microsoft Jet database engine cannot find a record in the table 'Monitor' with key matching    field(s) 'Mileage.MonitorId" (Error 3101)"  How do I set the value for the "Mileage.MonitorId" to be the same as the combo box?

Who is Participating?
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.

How are the two tables related?
How did you set up your combo box? Try using the wizard, and select the 'Find a record on my form based on the value I selected in my combo box' option. Make sure you include the MonitorID field as well as the MonitorName field when asked which fields you want to include in your combo box. You'll be given the option to hide the key column (MonitorID) in the next step so it will still look like it does now.
Jeffrey CoachmanMIS LiasonCommented:

My guess is that something got crossed when you related the tables.

The hint is that "MonitorType" does not belong in the Milage form. (it belongs on the Main (Monitor) form).
If you select a monitor, they should always be the same type, so there is no need to see this repeating data in the subform.

Always keep in simple at first.
  Make the tables
  Relate the tables
  Make the main form
  Make the subform
  Drop the subform on the main form, ...and TEST IT.

After you are sure it is working, ...THEN create any source queries you might need.

Here is a sample that approximates your setup.


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
softsupportAuthor Commented:
Thank you for your assistance.  I was so close.... I had the 2 tables (Monitor) and (Mileage) in the query which was causing the problem.  One the Monitor table was removed and I recreated the subform.... It worked like a charm.  Thank you for the example.  It showed me how to fix my error and your explanation reminded me of the KISS method... (Keep It Simple Stupid) (smile!)  Thanks again!!!!!!!!!!!!!!!!!!!1
Jeffrey CoachmanMIS LiasonCommented:
Don't feel bad, I have to remind myself all the time to "keep it simple", as well!

You can still create a query for the subform. You just have to be carefull of what fields you are bringing in , and why.

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.