Access 2013: Combo box in a form

Hello. I have a form to add some details for Mr.X (Mr_ID). The corresponding tables are Details_Table (Mr.X's data), Date_Table (visits of Mr. X to my office)  and Visit_Details_Table (what happened during the Visit). The tables are connected and working properly.

How can I create a combo box in a form which will contain the values from the Test_Date field, but ONLY the ones connected to the specified Mr_ID, so I can add details to a subform (Visit_Details_Table) and connect them to the Test_date?

Thanks
AlfaDBAsked:
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.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Simplest is to:

1. Base the combo's rowsource on a query.

2. In that query, add a reference to the Mr_ID control on the form.


=Forms![<my form name>]![txtMr_ID]

On the Mr_ID field

3. In the Got Focus event of the combo, do a requery of the combo so it's updated.   Note that you may be able to use the OnCurrent event of the form...not sure when the dates might change.   If no visits can be added while your viewing this form, then you can use the OnCurrent.

 But if new visits can be added while sitting on this form, then you'll need to use the GotFocus of the combo so it's always up to date.

Your combo will then only display dates associated with Mr_ID

Jim.
AlfaDBAuthor Commented:
Hm..
1) Ok
2) ...but includes all the values and not only Mr_ID ones. I added the reference to the Criteria field in the query
3) Used something like  
Me!sfMySubform.Form!cboMyCombo.Requery, on Got Focus, even though new values cannot be added. Nothing happened :(
AlfaDBAuthor Commented:

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
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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.