dbTalk Databases Forums  

Highlight first record in listbox on opening form?

comp.databases.ms-access comp.databases.ms-access


Discuss Highlight first record in listbox on opening form? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon Rowe
 
Posts: n/a

Default Highlight first record in listbox on opening form? - 12-17-2004 , 05:38 AM






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



Reply With Quote
  #2  
Old   
Bas Cost Budde
 
Posts: n/a

Default Re: Highlight first record in listbox on opening form? - 12-17-2004 , 05:58 AM






Simon Rowe wrote:
Quote:
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


Reply With Quote
  #3  
Old   
Darryl Kerkeslager
 
Posts: n/a

Default Re: Highlight first record in listbox on opening form? - 12-17-2004 , 04:24 PM



Alternative:

lst.Value = lst.ItemData(1)


Darryl Kerkeslager

Quote:
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.costbudde (AT) heuvelqop (DOT) nl> wrote:
Quote:
In the Load event of the form, set the ListIndex property of the listbox
to 0 (defaults to -1 I think)



Reply With Quote
  #4  
Old   
Stephen Lebans
 
Posts: n/a

Default Re: Highlight first record in listbox on opening form? - 12-17-2004 , 04:32 PM



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" <Kerkeslager (AT) comcast (DOT) net> wrote

Quote:
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.costbudde (AT) heuvelqop (DOT) nl> wrote:
In the Load event of the form, set the ListIndex property of the
listbox
to 0 (defaults to -1 I think)




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.