Results 1 to 2 of 2

Thread: combo boxes

  1. #1
    Join Date
    Apr 2009
    Posts
    8

    Question Unanswered: combo boxes

    access 2003

    hi all, i have the following problem. the tables are listed below. both combo's are in sync. the problem i am having is that cboPartID is showing pkPartID instead of the PartName. i have tried the code "Where PartName = cboCategoryID", however this causes a unknow key to be put in tblPartDetails. as the code stands, the right key for the part is put in tblChairDetails, but is shows as a key instead of text in cboPartId. how can i select pkPartId from tblparts but have it show PartName in cboPartID?? do i need to redesign tblParts so there is no pkPartId? if so, i thought it was good pratice to have a primary key in each table. is there another way to do this? thanks

    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 pkPartID = " & cboCategoryID & _
    " ORDER BY PartName"

    End Sub

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6

Posting Permissions

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