Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    8

    Unhappy Unanswered: synch two combo boxes

    hi all, i have the following problem. the tables are listed below. both combo boxes are in synch and show the right category/part. the problem is when i save it, the wrong keys/unknown keys for fkCategory and fkPart are put in tblChairDetails. thanks for the help

    tblCategories
    pkCategoryID
    CategoryName

    tblParts
    pkPartID
    PartName
    fkCategoryID

    tblChairDetails
    pkChairID
    fkCategoryID
    fkPartID

    cboCategoryID

    cboPartID

    the following code is added to the after update in cboCategories

    Private Sub cboCategoryID_AfterUpdate()

    On Error Resume Next

    cboPartID.RowSource = "SELECT tblParts.PartName FROM" & _
    " tblParts WHERE fkCategoryID = " & cboCategoryID & _
    " ORDER BY PartName"

    End Sub

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I believe you need to add pkPartID to the row source so that when a selection is made, that's the field that's saved. As is, it will be the part name.
    Paul

  3. #3
    Join Date
    Apr 2009
    Posts
    8

    Thumbs up sync combo box

    thanks for the help. when i changed it to the pkPartID, the pkPartID key number showed up in the cboPartID. The pkPartID that was saved is the correct part. how can i get the PartName from the table to show up in cboPartID instead of pkPartID. thanks

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Change the column widths property so that the ID field has a width of zero.
    Paul

Posting Permissions

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