sort listbox via A to Z button press

gwidijanto

Registered User.
Local time
Today, 12:33
Joined
May 4, 2003
Messages
28
Hi,
I need help with listbox problem:
I made a listbox contains peoples name from A to Z.
I want to sort it via A to Z button press.
It's similar with customer phone list form in Northwind.mdb sample,
due to my limited knowledge, I can't replicate it using listbox.

Any sample to do this?

Thankyou.

Gunawan.
 
you change the sort by changing the rowsource of the List
Here a quick demo, bit rough and ready but it will give you the idea.

Peter
 

Attachments

Thank's Peter,
it's so close but still too far :(
What I want is not A-Z and Z-A button, but index buttons (A button, B button...Z button, total 26 buttons and 1 for "show all" button), so when I press A button, it will show names with first letter A only on my listbox.
What I know is using wildcard --> LIKE 'A*' , but I don't know how to put it in button command.

Gunawan.
 
Hi Wayne,
thanks for your help.
I change it a little bit, I use command button instead of option button, I don't know how to change the listbox directly from button click, so I use textbox for this.
Please have a look at attached mdb file below.
If there is any better way to do this, please let me know.

Gunawan.
 

Attachments

While you have the cursor in a list box, all you need to do is type G and the box will scroll to the first entry starting with G. Same works with the second and subsequent keypresses, type GA and it will scroll to the first entry starting GA.

All you need to do is ensure the list is presorted in alphabetical order. No coding required!
 
Gunawan,

Neil is right, Access will let you "filter" the ListBox, based on the first letter
that you type.

But ... As an experiment, I put the example together.

You can use Command Buttons (or textboxes), but then you will need an
Event for each Button (or textbox). I didn't want to do that. The option
box method, required the use of only ONE event.

For a practical solution, I'd either use the Native capabilities of Access (as
Neil said) or write an event for each control used.

Wayne
 
Hi,
thanks Neil, using Access capability is very simple, but I must write a direction how to use this capability, so everybody using my phonebook can understand.
Wayne, thank's for your explanation why you use option button instead of command button but I'm still curious with Northwind sample, it use command button with macro to control the filter, is it possible using it with listbox?

Gunawan.
 

Users who are viewing this thread

Back
Top Bottom