View Single Post
  #4 (permalink)  
Old November 10th, 2004, 01:35 PM
wscheiman wscheiman is offline
Authorized User
Join Date: Oct 2003
Location: Cleveland, OH, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Rudner,

From what it looks like (just to be sure), this is the basic sequence of events as I understand them:

 - The combo box Combo1 is populated using the .AddItem method
 - The user clicks on the combo box and selects one of the items
   in the list
 - Once the item has been selected in the combo box, the category
   ID from the combo box is to be copied into the text box named

I was assuming that you are doing this in MS-Access - if you're doing this in VB, please let me know. I DO want to get you the answer you're actually looking for. :D

Working with assumptions for now, if you're using Access, first of
all you can set the following properties for your Combo1 combo box:
 - ColumnCount = 2
 - BoundColumn = 1 (assuming you want to store the category ID in the combo box)

I was assuming MS Access when I sent you my initial reply.

Regardless if it's VB or Access, it appears that you want to copy the CATEGORYNAME from the combo box to the textbox only AFTER the user has made a selection. If that is the case, please keep in mind that the Click() event runs when a user clicks on the field. The reason that I indicated using the AfterUpdate event in Access is that it will not kick off until AFTER the user has updated the value from its original value. For example, if the combo box was blank or NULL, and then the user made a selection, the AfterUpdate event will automatically kick off and THAT is when you'd want to update the contents of the texbox. Therefore, you probably don't want to use the Click event.

The other part of the situation occurs as when you bring up an existing record (assuming you're using Access). If the Text6 textbox is an unbound field, you will want to display the CATEGORYNAME value if there is a CATEGORYID present in the Combo1 combo box. In that case, you would put the following code into your Form_Current() event:

Private Sub Form_Current()
   If Not IsNull(Me.Combo1) Then
      Me.Text6 = Me.Combo1.Column(0)
   End If

End Sub

Actually, I could go on an on (as I have), but if you can let me know if you're using VB or Access for the combo box, I can hopefully give you a more efficient answer. :)

Please let me know when you get a chance.

Reply With Quote