Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update 2 fields with 1 combo box (Access 2000)

    Hi,
    Hope someone can help. What I

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    A combo box can have more than one column (hidden, if so desired), so what you want should be possible. Can you tell us how you use the combo box now to "look up a value from table1 and add it to table2"?

  3. #3
    New Lounger
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    I have just used the combo box wizard in access but the wizard one seems to let you have one value.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    In the third step of the Wizard, where you select the fields to be included in the combo box, make sure to include both fields you want. Further on, you can specify only one field to store the value in; select the field corresponding to the first column.
    When you have created the combo box, make sure that it's still selected.
    Activate the Other tab of the Properties window.
    Enter a meaningful name in the Name property (a name such as Combo13 doesn't give an indication of what the combo box is for.)
    Activate the Event tab of the Properties window.
    Click in the After Update event.
    Select [Event Procedure] from the dropdown list.
    Click the ... button to the right of the dropdown arrow.
    The Visual Basic Editor will be activated, with the first and last lines of the event procedure already created for you.
    Let's say that your combo box is named cboField1, and that the field corresponding to the second column is named Field2.
    Make the code look like this:

    Private Sub cboField1_AfterUpdate()
    Me.Field2 = Me.cboField1.Column(1)
    End Sub

    Columns in a combo box are numbered starting at 0, so Column(1) refers to the 2nd column.
    You can now switch back to Access.

  5. #5
    New Lounger
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    got it working thanks !!!!

    one last thing how do I hide the second value from the combo box ?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    Open the form in design view.
    Select the combo box.
    Activate the Format tab of the Properties window.
    Enter something like <code>1";0"</code> in the Column Widths property.
    By setting the width of the second column to 0, you hide it.

  7. #7
    New Lounger
    Join Date
    Aug 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update 2 fields with 1 combo box (Access 2000)

    Thank you !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •