How to Make ComboBox Set Two Fields

C

Chaplain Doug

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.
 
J

jahoobob via AccessMonster.com

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)
 
J

jahoobob via AccessMonster.com

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)
 
G

Graham R Seach

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
 
Top