473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Highlight first record in listbox on opening form?

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
3 5000
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: ChrisR | last post by:
Hi guys My app is a simple Main form with a few Subforms that are not linked, and a few pop forms. Problem is: I have a pop form with a Listbox with a list of records related to the...
5
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and...
3
by: RC | last post by:
I have a form where the user enters the Model info. The user picks the Model from either a combobox or listbox which both are filled from the Models table. If the Model type isn't in the boxes,...
11
by: scsTiger | last post by:
I am using Access 2000 as the front end and MS SQL 2000 as the backend. I have a one record form that I set using something like: strSQL = "SELECT * FROM dbo_WBACCT WHERE...
22
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a form (frm_Entrainment) with a button that opens a 2nd form (frm_Specimen_Entrainment). The 2nd form shares an ID field with the first form (Entrainment_ID - its like opening...
5
Scott Price
by: Scott Price | last post by:
I'm not quite ready to give up on this yet... Using MS Access 2003, WinXP SP2. I have a listbox that I'm trying to get to highlight (select) a specific record using the GotFocus event (the...
7
by: Randy | last post by:
Hi, I've got a listbox on a form that gets updated by opening another form for data entry. Once the user enters the new item name and clicks "accept", the data entry form closes and the original...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
2
by: lhsiber | last post by:
I am new to access and am having a problem with filtering. Here is a little bit of my setup: I have a main form that has a listbox so that users can choose one or many groups in which to display...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.