Display Values from 2 Tables Onto 1 Form

dome

Registered User.
Local time
Today, 01:45
Joined
Feb 13, 2002
Messages
14
Greetings,

I have a form with a combo box that is used to select a product from another table. I would like to display other field values, associated with the item selected in the combo box on the form.

Can anyone help?
I know that I'm overlooking something simple

Thanks
Dome
 
Hey Dome,

In your combo box add the fields from the products table that you would like displayed. Set the column width for those values to 0 (unless you want the user to see them in the combo box), then add unbound text boxes for each value that you want. After you've done that in the combo box After Update event type the code for each text box.

i.e.
Me![UnboundTextBoxName] = Forms![FormName]![ComboBoxName].Column(2)

Remember the columns start counting at 0

HTH
Shane
 
Thanks Shane,

Is that a macro that's passing the value?

How and where do I add the additional field in the control box?

(Sorry for being so ignorant!)

Thanks
Dome
 
Is that a macro that's passing the value?

No, it's VBA

How and where do I add the additional field in the control box?

In your combo box go to properties and click on the second tab. There you should find Row Source. Click on the ... button to the right of the field. This will take you to the query behind the combo box. Choose the table that you want the combo box to get its values from. Then double click on the field that you want added to the grid below or drag and drop the field. Put the ID field as the first field. Count how many columns you have. Then close the query and choose to save it when asked. Then go to column count and put the number of columns in that you counted. Then go to column widths and for each column you need to type the width of your columns. O will hide a column. If you have the ID field as your first field then your bound column will be 1.

Now add unbound text fields to your form for each column you want to reference to a column in your combo box. Then go back to the combo boxes properties and go to the After Update event and type code to tell the combo box to put values into your text boxes. For example:

Forms![FormName]![TextBoxName] = Forms![FormName]![ComboBoxName].Column(1)

The column count starts with 0 so the first column to the left is 0. You will need to repeat the code for each text box. You should have the same number of text boxes as columns in your combo box that you want to get values from.

(Sorry for being so ignorant!)
Not ignorant, Uninformed!

Hope I've helped. Please post back if you still have questions. Myself or one of the many who help here, will be more than glad to get you through.

Thanks
Dome
 

Users who are viewing this thread

Back
Top Bottom