How to jump to a record in a listbox?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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
____________________
 
This line of code in your combo box after update event will do that

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