How to Make ComboBox Set Two Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 2003. Currently I have a combobox that displays three columns on the
dropdown. The bound column assigns the value to a field in my table.
However, I would like to have two bound columns setting two fields in my
table. How may I accomplish this? Thanks.
 
If the first column in the combo (Combo1) is the bound column and you have
other text boxes (Text1 and Text2) on the form to display what is in the
other two columns of the combo you can place the following code in the
AfterUpdate of the combo
Sub Combo1()
Me!Text1=Combo1!Column(1)
Me!Text2=Combo1!Column(2)
End Sub
Note that Column(1) refers to the second column of the combo. The first
column is Column(0)
 
If the first column in the combo (Combo1) is the bound column and you have
other text boxes (Text1 and Text2) on the form to display what is in the
other two columns of the combo you can place the following code in the
AfterUpdate of the combo
Sub Combo1()
Me!Text1=Combo1!Column(1)
Me!Text2=Combo1!Column(2)
End Sub
Note that Column(1) refers to the second column of the combo. The first
column is Column(0)
 
Doug,

Private Sub cboCombo_AfterUpdate()
If Not IsNull(Me.cboCombo) Then
Me.txtTextbox1 = Me.cboCombo.Column(0) '1st column
Me.txtTextbox2 = Me.cboCombo.Column(1) '2nd column
Me.txtTextbox3 = Me.cboCombo.Column(2) '3rd column
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top