MSAccess returning null value until selected row clicked twice

Have a bound listbox.

When I click on the first row I am not able to return the value selected unless I click a second time.

When I bind a textbox to the listbox I can also see the value showing only on the second click.
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.

Jeffrey CoachmanMIS LiasonCommented:
You did not post any info on:
If the listbosx is set to Multiselect?
How many columns the listbox has?
What code you are using now?

I typically avoid the onclick even and instead try to use the "AfterUpdate" event

This code works fine for me:

Private Sub Yourlistbox_AfterUpdate()
    MsgBox Me.Yourlistbox
End Sub
hertzgordmanAuthor Commented:
The listbox is not set to MultiSelect.

In the afterupdate event I am running this piece of code:

MyRecordID = Nz(MyListBox.column(0))

This issue is that when you first click into the the listbox you can see the first row highlighted.  Yet MyListBox.Column(0) returns null.

When you then click the same row ago MyListBox.Colomn(0) now returns the expected value.
Jeffrey CoachmanMIS LiasonCommented:
Well I don't know the full scope of your app (the entire code, properties, ...settings, ...ect)...

These things being said, ...this simple example woks just fine for me...
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

hertzgordmanAuthor Commented:
Thanks Boag will have look.  I am thinking its an issue related to a corrupted form or index. I will see if I can post a db to reproduce the error.
Jeffrey CoachmanMIS LiasonCommented:
<I am thinking its an issue related to a corrupted form or index>
Try the usual:
- Run the compact/repair utility
- decompile the database (
- Create a blank new db, and import all the objects

Sometimes you can also try replacing the listbox, ...but sometimes you have to bite the bullet and recreate the form...

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
hertzgordmanAuthor Commented:
Thanks Boag will try what you suggest...
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.