By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 1,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Highlight first record in listbox on opening form?

P: n/a
Probably really simple but I cant work it out...

I have a list box on a form with a few records in. When I open the form the
first record is sort of highlight with a dashed box, when I cursor down the
record changes to inverse video and from then on I can sroll up and down the
records with the inverse video highlight.

I just cant seem to get the form to open with the first record already
highlighted in inverse video.

I have tried setting the focus to the listbox on opening the form and I have
also tried using sendkeys to imitate me pressing the down arrow but nothing
seems to work.

Please help?

Thanks
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Simon Rowe wrote:
Probably really simple but I cant work it out...

I have a list box on a form with a few records in. When I open the form the
first record is sort of highlight with a dashed box, when I cursor down the
record changes to inverse video and from then on I can sroll up and down the
records with the inverse video highlight.

I just cant seem to get the form to open with the first record already
highlighted in inverse video.

I have tried setting the focus to the listbox on opening the form and I have
also tried using sendkeys to imitate me pressing the down arrow but nothing
seems to work.


In the Load event of the form, set the ListIndex property of the listbox
to 0 (defaults to -1 I think)

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2

P: n/a
Alternative:

lst.Value = lst.ItemData(1)
Darryl Kerkeslager
Simon Rowe wrote:
I just cant seem to get the form to open with the first record already
highlighted in inverse video.

"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote: In the Load event of the form, set the ListIndex property of the listbox
to 0 (defaults to -1 I think)

Nov 13 '05 #3

P: n/a
Daryl the reccommended approach handles the ColumnHeads prop:
Me.Combo1.Value = Me.Combo1.ItemData(Abs(Me.Combo1.ColumnHeads))

Just my $.02

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:sM********************@comcast.com...
Alternative:

lst.Value = lst.ItemData(1)
Darryl Kerkeslager
Simon Rowe wrote:
I just cant seem to get the form to open with the first record already highlighted in inverse video.
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote:
In the Load event of the form, set the ListIndex property of the

listbox to 0 (defaults to -1 I think)



Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.