Results 1 to 8 of 8
  1. #1
    Alhassani is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    53

    Angry Combo Box saves wrong information after combo box selection

    I am trying to build a database to replace the Excel databases I created months ago. I've been googling and working through most of the issues that have come up, but this one has completely stumped me.

    The main form to record the audit has a single combo box that populates and records 3 other fields based on the selection. The combo box contains the employee's name. A selection here then automatically updates and adds the employee's supervisor, manager, and employee ID. This was working exactly as intended when I built it an hour ago. Now, it saves the correct supervisor, manager, and employee ID but not the employee selected. Instead, it saves the employee immediately above in the combo box list.


    So, if the options were "John Smith", "Mike Adams", "Luke Picard", and I select "Mike Adams" all of Mike Adams' additional information will be correct, but his name will be recorded as "John Smith". The specifics of my form is below.

    Combo Box: "RMsCB", 4 columns with widths at 1",0",0",0". Control source is "RMs" and Row Source is from a "RefManagers Query" that returns the information given below. There is an "AfterUpdate" event with the following code:

    Code:
    Private Sub RMsCB_AfterUpdate()
    txtEmpID = RMsCB.Column(1)
    txtTeamLead = RMsCB.Column(2)
    txtSectLead = RMsCB.Column(3)
    End Sub
    Any help is appreciated. Thank you.

  2. #2
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Had a similar issue. If you remove the AfterUpdate event completely, does the record you clicked still not appear as selected?

    If so, copy the combo box and paste it. Use the new one in place of the old. Don't try to select a record. If it works, rename it to the name of the old, and re-enable the event. Should work. I'm sure there is an actual reason for this issue, but this seems to work for me when needed.

    If this doesn't work, I'm stumped as well.

  3. #3
    Alhassani is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    53

    Attempt #1

    I removed the AfterUpdate event as well as a "On Dirty" and "On Unload" event that was refreshing and saving the record. Didn't work. Then copied combo box and selected an employee with the same results. What did you mean by "Don't try to select a record"? Was that a typo? If not, how can I verify that it is working or not??


    Quote Originally Posted by snipe View Post
    Had a similar issue. If you remove the AfterUpdate event completely, does the record you clicked still not appear as selected?

    If so, copy the combo box and paste it. Use the new one in place of the old. Don't try to select a record. If it works, rename it to the name of the old, and re-enable the event. Should work. I'm sure there is an actual reason for this issue, but this seems to work for me when needed.

    If this doesn't work, I'm stumped as well.

  4. #4
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Quote Originally Posted by Alhassani View Post
    What did you mean by "Don't try to select a record"? Was that a typo? If not, how can I verify that it is working or not??
    Oops, definitely a typo. Mind was elsewhere. I meant "Then try to select a record."

    So you're saying that even on the copied combo box, with no events attached to it, selecting a record seems to select the next one on in the list?

    Just for grins, If your answer is "yes" to my questions just confirm that this is a real issue. On the after update event, comment everything that you have out, and add:
    Code:
     debug.print me.RMsCB.Column(0)
    See if that is the same as the record that shows to be selected.

  5. #5
    Alhassani is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    53
    Yes, even with no events attached to it, it was still selecting the next record.

    What is the debug.print command supposed to do? Is there supposed to be a box or something? I'm asking because nothing happens. It displays the person on the form that I selected, and it doesn't update anything on the database.

    I can still select the record, but now there is a disconnect between the database and the input form. For example, the database shows 7 records while the input form shows 5. I deleted all the test records and they sync'd back up. But a quick entry of 4 test records throws it off again.

  6. #6
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    debug.print just outputs to the immediate window (ctrl-g). Since you commented everything else out, that is the only code that is firing. Just to see what access actually sees in that combo box.

  7. #7
    Alhassani is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    53
    Oh, thats neat. Yes, access is seeing what I am selecting correctly. I did notice that some of the backend doesn't seem to line up.

    The control source is "RMs" while the name of the field it is actually populating is "Referral Management Specialist", not "RMs". The row source is "RefManagers Query". The list that comes up in RMsCB is the same list that comes up in "RefManagers Query". However, the list that is saving is what is pulled in the lookup function of the "Referral Management Specialist" field.

  8. #8
    Alhassani is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    53
    Fixed it! The lookup values in the table were conflicting with the query running to generate the names. In the table design section I redefined the row source properly. Once that was completed and the adjustments for bound columns and column widths were made to reflect the correct process, the database is now working as intended again. Thanks for the help snipe!

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

Similar Threads

  1. Replies: 6
    Last Post: 02-19-2014, 11:11 AM
  2. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  3. Form Combo Box Saving Wrong Information
    By Steve62 in forum Reports
    Replies: 5
    Last Post: 11-12-2012, 02:29 PM
  4. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  5. Replies: 33
    Last Post: 01-13-2012, 07:44 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