Avatar of Benyaw
Flag for Australia asked on

Default First Row in List Box

how do i make the first record in my list box selected....

i've tried [itemdata] & [selected] but no joy... i urgently need to solve this..

any help appreciated

Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
Scott McDaniel (EE MVE )

To select the first row:

Me.YourListview.Selected(0) = True
Dale Fye


That will select the first item, but if you immediately print the value of the list, it will still be null.  I use

Me.lst_Numbers = Me.lst_Numbers.ItemData(-Me.lst_Numbers.ColumnHeads)

you could use 0 as the index # for ItemData, but if you have ColumnHeads turned on, it will not work, so I generally just use this all of the time.
Scott McDaniel (EE MVE )

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dale Fye

Actually, you need two lines, one to set the value and the other to actually select the item in the list:

Me.lst_Numbers = Me.lst_Numbers.ItemData(-Me.lst_Numbers.ColumnHeads)
Me.lst_Numbers.selected(-Me.lst_Numbers.ColumnHeads) = true

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Dale Fye


you are correct, my bad.  Have not had my coffee yet.  I was thinking you had to set the value of the list as well, so I guess the 2nd line would suffice for all circumstances.

Me.lst_Numbers.selected(-Me.lst_Numbers.ColumnHeads) = true