[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


link combo box to table row

Posted on 2006-05-15
Medium Priority
Last Modified: 2012-06-21
This is probably a dead-simple question, but I haven't done it yet.

I have a form with a table specified as the record source. The form has a combobox and several text boxes. The combo box's record source select all the table's keys. The other text boxes are bound to columns in the table. When I open the form it brings up the information for the 1st row in the table, including the key in the combo box.

When I pop-down the combo box and select a different key, the keyvalue changes in the combo box, but the other text boxes remain with the original data. So, changing the keyfield combo box value does not cause the form to requery the table data.

How do I make it do this?

Question by:jmarkfoley
  • 3
  • 2
LVL 61

Accepted Solution

mbizup earned 2000 total points
ID: 16687662
You need to explicitly tell the form to go to the record specified in the combo box.  If you don't have one already, create a textbod that is bound to the field specified by your combo box selection (your combo box should be unbound).  Then add this code to the afterupdate event of your combobox:

DoCmd.GoToControl "YourTextBoxName"              '***  change these names to your application specific text and combo box names.
DoCmd.FindRecord Me.cboYourCombo

Author Comment

ID: 16687885
OK, that looks like it's going to almost work. Two  problems: 1) when the form is first opened the combo box is empty. I'd like to set this to the initial value of my bound text box. 2) when I use the row navigation arrows at the bottom of the form, the key values in the text box change, but the value in the combo box does not.

These seem like they could share the same solution, but I don't quite know what to do. Basically, I want to set my combo box value if the text box changes (on load, or via nagivation arrows), and set the text box value if the combo box changes (your suggestion), but I don't want to get into an endless loop.
LVL 61

Expert Comment

ID: 16689687
Add the following code to your form's Current event (this should take care of both issues)

cboYourComboBox = txtYourTextbox

Author Comment

ID: 16691989
You're a genius! Works great!
LVL 61

Expert Comment

ID: 16692031
A little extreme, but I appreciate the compliments :-)

Glad to help!

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question