Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

combo box help!

Discussion in 'Information Technology' started by Kirt84, Jul 28, 2006.

Tags:
  1. Kirt84

    Kirt84
    Expand Collapse
    Guest

    I have a Subform which contains a Combo Box with two columns - Products &
    their Product code. I need a feature where I can select a product from the
    list and it automatically drops the Product code into a Stock Code text box.
    Any help would be appreciated,

    --
    Thank you for your help
     
  2. Loading...


  3. Martin Austin

    Martin Austin
    Expand Collapse
    Guest

    You would want to use the OnUpdate event for the combo box, and populate into
    your textbox. You would set your textbox value with the Value attribute, and
    grab the Product Code using the Column method of the combobox control.

    I hope this helps. I'm new here, so first post! Good luck.
    --
    ¤ Martin Austin


    "Kirt84" wrote:

    >
    > I have a Subform which contains a Combo Box with two columns - Products &
    > their Product code. I need a feature where I can select a product from the
    > list and it automatically drops the Product code into a Stock Code text box.
    > Any help would be appreciated,
    >
    > --
    > Thank you for your help
     
  4. Ken Sheridan

    Ken Sheridan
    Expand Collapse
    Guest

    Martin is spot on with his reply, but note that the Column property is
    zero-based, so Column(0) is the first column and Column(1) the second. If
    the code is in a hidden first column say, then the code for the control's
    AfterUpdate event procedure would be along these lines:

    Me.txtStockCode = Me.cboProducts.Column(0)

    However I'm treating this as a potential Road to Dublin question and I'd
    express a caveat here; only one of these controls should be bound to a field
    in the underlying table. To have both the code and the product name in the
    table would be redundant and leave the door open to update anomalies.
    Normally in situations like this you'd just store the code in the table in
    which case the combo box would be the bound control. You would not then need
    any code to populate the unbound text box; just set its ControlSource
    property to:

    = cboProducts.Column(0)

    Ken Sheridan
    Stafford, England

    "Kirt84" wrote:

    >
    > I have a Subform which contains a Combo Box with two columns - Products &
    > their Product code. I need a feature where I can select a product from the
    > list and it automatically drops the Product code into a Stock Code text box.
    > Any help would be appreciated,
    >
    > --
    > Thank you for your help
     

Share This Page