Combo box changes to first entry when end user clicks inside combobox Access 2003 VBA

Hi all.

I have an Access form with a combobox whose row source is set to "Table/View/StoredProc" and is populated in the On Enter event. There are 2 columns with widths (0";1") the first column is the ID and the second is the name, the end user sees the name but when they save the record the ID is what gets saved in the table.

The problem we're having is if the end user enters the combobox via the mouse or tab without clicking on the down arrow it temporarily changes the selected value/text of the combobox to the first entry of the combobox but then it reverts back to the original selected value/text when you leave the combobox.

Any idea how we can stop this from happening?

Thank you in advance.
printmediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
Do you have code (or a macro) in one of the control's events that is causing this?
0
printmediaAuthor Commented:
All I have is the code to load the combobox in the On Enter event.
0
PatHartmanCommented:
That is the code that is causing the problem.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
as Pat said, the code filling the value must be the problem.  Look for a statement with ItemData(1) or ItemData(0) if headers are not displayed.  This code picks the first choice only if there is not already a value:
With Me.ActiveControl
   If IsNull(.Value) Then
      .Value = .ItemData(0)
   End If
End With

Open in new window

have an awesome day,
crystal
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.