Results 1 to 13 of 13
  1. #1
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8

    Combo box not displaying selected item name

    my combo box displays the item ID and not the item name.

    Example: Item id is 2. Item Name is "ac"

    combo box displays 2 when ac is selected.

    Click image for larger version. 

Name:	ComboDisplay.jpg 
Views:	14 
Size:	11.9 KB 
ID:	23548

    Click image for larger version. 

Name:	comboError.jpg 
Views:	14 
Size:	5.5 KB 
ID:	23549

    How can I fix this?

    Thanks

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    There are number of tutorials re: Comboboxes at techonthenet

    see. Combo

  3. #3
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    I have 10 years experience using access. There are 3 other combo boxes on this form that are working as expected.

    I cannot find properties about this one that are different.

  4. #4
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    I don't think comboboxes care how much experience you have
    Try Bound Column, Column Count, Column Widths.

  5. #5
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    The cboSection combo box row source is set in code and works as expected.

    'code
    Private Sub cboSection_AfterUpdate()
    'Prepare the Range combo box
    'Set Row Source for Range combo for selected section
    Dim strSQL As String
    Dim intSectionID As Integer
    intSectionID = Me.cboSection.Column(0)
    Me.txtSectionID = Me.cboSection.Column(0)
    strSQL = "SELECT tblRange.RangeID,tblRange.RangeName,tblRange.Secti onID "
    strSQL = strSQL + "FROM tblSection INNER JOIN tblRange ON tblSection.SectionID = tblRange.SectionID "
    strSQL = strSQL + "WHERE (((tblSection.SectionID) = " & intSectionID & ")) "
    strSQL = strSQL + "ORDER BY [RangeName];"
    Me.cboRange.RowSource = strSQL
    Me.cboRange.Enabled = True
    End Sub

    /code

    cboSection:

    row source is a query that returns 3 columns
    column count = 3
    bound column = 0
    Column Widths = 0";1";0"

    cboRowTest does not work as expected
    row source is a 3 column table containing only 5 rows for development testing
    column count = 3
    bound column = 0
    Column Widths = 0";1";0"

    I have tried many property setting variations.

  6. #6
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Access uses zero-based numbers when you're refering to Column property in VBA (like myCombo.Columns(0) means first column in collection). However Bound Column property in properties window is 1-based, so first column has number 1, not 0.

  7. #7
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    Work around.
    Created a text box to display the selected name.
    Private Sub cboRange_AfterUpdate()
    'Display selected range name in text box
    Me.txtSectionID = Me.cboRange.Column(1)
    End Sub

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    How about posting a copy of your database, with enough data to highlight the issue? Remove anything confidential before posting.
    In your graphic in post #1, why is the 2 left justified?

  9. #9
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    Thanks,

    I was using zero based as a reference to the control column.

    However, this did not fix the issue.

  10. #10
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    I would be happy to post a copy of the database.
    There is nothing confidential in this development version.
    How do I post?

    Thanks

  11. #11
    orange's Avatar
    orange is online now Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  12. #12
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    Access 2016 database upload as attachment failed. File size is 3 megs. Is this too large?
    I can zip it or remove extra objects.

  13. #13
    dovberman is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Location
    Biloxi, MS
    Posts
    8
    The work around is OK. I will explain this on the form.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-24-2015, 02:45 PM
  2. Replies: 8
    Last Post: 06-26-2014, 08:52 AM
  3. Combo box - Open at last item selected
    By mitchy1111 in forum Programming
    Replies: 2
    Last Post: 10-07-2011, 07:23 AM
  4. Replies: 7
    Last Post: 08-31-2011, 05:09 PM
  5. Replies: 1
    Last Post: 11-23-2010, 01:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums