Link to home
Start Free TrialLog in
Avatar of softsupport
softsupportFlag for United States of America

asked on

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?

frmMonitor.jpg
Avatar of Badotz
Badotz
Flag of United States of America image

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.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of softsupport

ASKER

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
Great!
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.
;-)

JeffCoachman