View Single Post
  #2 (permalink)  
Old November 8th, 2004, 11:19 AM
wscheiman wscheiman is offline
Authorized User
Join Date: Oct 2003
Location: Cleveland, OH, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts


Here's the easiest way to do it - it goes under the AfterUpdate() for the combo box:

Private Sub Combo1_AfterUpdate()
   If IsNull(Me.Combo1) Then
      Exit Sub
   End If

   Me.Text6 = Me.Combo1.Column(0)

End Sub

Attach this code within your event properties under the AfterUpdate for the combo box.

The first part will ensure that a NULL value will not be copied to the text box, in the remove event that a NULL value could be selected in the combo box. The second part will copy the data from the 1st column (Column 0) in your combo box to the text box. If you specified Me.Combo1.Column(1), the category name would have been copied to your textbox.

If you don't use the .Column property, it will copy the value from
whatever value is specified as your BoundColumn for the combo box. One thing to remember is that when you use the .Column property, the values start with 0, 1, 2, 3, etc. However, the Bound Column property starts with 1, 2, 3, etc.

Hope that helps.

Reply With Quote