How to fill in a text field value based on a value in a Combo Box in MS Access 2007?

I have a combo box with a search type, i.e. I selected the source for the column from the table and save the selected value in another table. There is another column in the table I'm looking at, and I need the value in that column to appear in the text box, and every time I change the value in the combo box, I need the corresponding value to be displayed in the text box. How can i do this? What I have done so far is to write a query Selectthat selects the appropriate column based on the value of the combo box. Is there a better way to do this? Please help me!

+5
source share
3 answers

Make the source of the combo box for two fields, for example. SELECT id, name FROM Customers
Make sure you set the Count property of the combo column to 2, respectively.
Then create a source of an unrelated text field equal to =MyCombo.Column(1)(from memory, this column is based on a zero value).
This is a null code.

+12
source

It is better to use an event in a combo box, for example. onChange, therefore, when a choice is made, the event sets the value of the text field.

me!txtTextBox1 = me!cboComboBox1.column(1)

Thus, it will work every time.

onClick .., (, , , 0 .

+3

, , ():

combobox, :

, , combobox. NEW, ,    .

:

=[DefaultAcct].[Column](1) & "  " & [DefaultAcct].[Column](2)

onchange .

Private Sub DefaultAcct_Change()
    txtConcatenate1.SetFocus   
End Sub
0
source

All Articles