Results 1 to 2 of 2

Thread: combobox

  1. #1
    Join Date
    Apr 2004

    Unanswered: combobox


    is it possible to display records of two attributes (primary keys of one table) in one combobox and save the selected record in another table in the corresponding attributes?

    I have res_id and res_line_id which are PKs of the table resource_line
    I want to display all the records of the table resource_line in the combobox, however additionally some other attributes.
    Based on the users selection res_id and should be stored in res_id of table orders and res_line_id should be stored in res_line_id of table orders.

    Could someone please provide me help in accomplishing that?
    Thanks in advance!

  2. #2
    Join Date
    Sep 2003
    Caldes de Malavella, Spain
    This will give you problems, as I'm sure you know, because there can be only one Control Source for a combo box, i.e. only one destination field.

    Off the top of my head, the way to accomplish this would be to use code to take the two values from the combo box and write them into a new record. This would run after the user had selected a row in the combo box, or perhaps after they have pressed an "OK" button the confirm the operation.

    Let's look at this in more detail. If your combo box is called CmbRes, and you have Res_ID and Res_Line_ID as the first two columns, the code section that writes the record into TblOrders would look something like:

    myset!Res_ID = CmbRes.Column(0)
    myset!Res_Line_ID = CmbRes.Column(1)

    ...where "myset" is the name of the recordset you've opened on TblOrders.
    The important thing to note here is that you can reference any column of a combo box (or a list box, for that matter) by its ordinal number, where the first column reading from left to right is always column zero. Hope this helps!!
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy

Posting Permissions

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