Results 1 to 3 of 3
  1. #1
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72

    Combo box selection is returning data from the wrong row

    Hi all. I'm having trouble with something that usually seems quite simple. I have four columns in a combox box and the record source is a table with many records. One of the fields is Location and that is what the user is selecting on. However, when the Location, e.g. "10" shows up on four separate rows in the combo box, the data (which I'm loading into text boxes) always comes from the first of the four rows. In other words, from the row with the first Location "10", even though the user selected the third Location "10". I'm getting from the Help screens that there's a way to iterate through the rows to find the correct one, but when I try it, the code becomes convoluted looking. Is there a straight-forward way to get the right data? Here's a more detailed example of what I'm talking about:



    Location Customer Region Unique Key
    10 Joe 1 12345
    10 Al 2 23456
    10 Jack 3 808070
    10 Murphy 4 123050

    I couldn't get the data here to line up under the headings, but you get the idea.
    When the user selects the third "Location 10", the data going to the text boxes returns the data from the first row. In other words:
    Me.txtUKey = Me.cboUKey.Column(3) returns "12345" instead of "808070" as it should. Any help would be greatly appreciated and thanks in advance.
    Glenn

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Have you tried setting the width of all four columns to more than zero so that you can easily find what is going wrong ? What code you are talking about ? A textbox on a form with controlsource set to =cboUKey.Column(3) should show the Unique Key.

  3. #3
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72
    It looks like the problem came from a different part of the app where I was trying to get the name of the Region based on the Location alone. When i went back and removed that code and used something more suitable, it seems to have straightened itself out. Thanks for your input. Glenn

    Quote Originally Posted by amrut View Post
    Have you tried setting the width of all four columns to more than zero so that you can easily find what is going wrong ? What code you are talking about ? A textbox on a form with controlsource set to =cboUKey.Column(3) should show the Unique Key.

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

Similar Threads

  1. Forms - returning wrong value
    By Sheba in forum Forms
    Replies: 1
    Last Post: 11-12-2014, 02:02 PM
  2. Returning wrong items
    By cbende2 in forum Access
    Replies: 5
    Last Post: 08-01-2014, 07:43 AM
  3. Replies: 4
    Last Post: 06-12-2014, 07:01 AM
  4. Replies: 7
    Last Post: 05-21-2014, 02:55 PM
  5. DMax returning wrong value
    By nedbenj in forum Access
    Replies: 7
    Last Post: 10-24-2007, 10:30 AM

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