How to jump to a record in a listbox?

B

Baby Face Lee

I posted a similar question a few days ago but as I didn't explain myself
very well I'm posting again. Hope you don't mind.
This is what I've got:
Form without a control source
Purpose of the form is to enable users to pick various 'clients' from a
listbox so that the address details can be printed on labels
Listbox displays all client records from a table - Field A (long Integer)
and Field B (Text). Field A is the bound column.
The listbox is a multi-select listbox as I want users to be able to select
as many clients as required.
This all works fine BUT as there are around 15,000 different records in the
listbox it would be helpful if the user could enter the ClientID (Field A)
and 'jump' to that record within the listbox.
I've put a textbox on the form (txtJump) together with a command button
(cmdJump) that will 'find' the record when clicked but I don't know how to
get this to work!! All my attempts have failed.
Can you advise me (in words of one syllable!) on how to achieve this?
Many thanks for any advice.

Lee
 
K

Klatuu

15,000 is a lot of rows for a list box. My suggestion would be to use a
combination of a combo box with Auto Expand set to Yes, and a List Box. In
the After Update event of the combo box, you can add the selection from the
combo box to the rowsource in the list box and set it's selected property to
True. Once the user has selected all the clients, you can have a command
button to print the labels for each row in the list box using the
ItemsSelected collection.
 
B

Baby Face Lee

Thanks Klatuu, that sounds a great suggestion but I don't know how to add a
record to the RowSource I'm afraid!
Would you be able to elaborate further or provide some pseudo code?
Regards,

Lee
____________________
 
K

Klatuu

This line of code in your combo box after update event will do that

Me.MyListBoxName.RowSource = Me.MyListBoxName.RowSource & ";" & _
Me.MyComboBoxName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top