If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Adding an Alpha Search Button on a form
Does anyone know how to add Alpha search button on a form? For example, I
have a list of 600 names in my table, what I want on the top of my form is alphabets A-Z and when someone clicks on any letter, all the names starting with that letter show up. Can anyone help me? Thank you for your time. |
#2
|
|||
|
|||
I maanged to do this by using an option group with A-Z and an All button as
well and use the code below to restrict the list to the relevant names: Dim strSearchChr Select Case SearchOption Case 1 strSearchChr = "A" Case 2 strSearchChr = "B" Case 3 strSearchChr = "C" Case 4 strSearchChr = "D" Case 5 strSearchChr = "E" Case 6 strSearchChr = "F" Case 7 strSearchChr = "G" Case 8 strSearchChr = "H" Case 9 strSearchChr = "I" Case 10 strSearchChr = "J" Case 11 strSearchChr = "K" Case 12 strSearchChr = "L" Case 13 strSearchChr = "M" Case 14 strSearchChr = "N" Case 15 strSearchChr = "O" Case 16 strSearchChr = "P" Case 17 strSearchChr = "Q" Case 18 strSearchChr = "R" Case 19 strSearchChr = "S" Case 20 strSearchChr = "T" Case 21 strSearchChr = "U" Case 22 strSearchChr = "V" Case 23 strSearchChr = "W" Case 24 strSearchChr = "X" Case 25 strSearchChr = "Y" Case 26 strSearchChr = "Z" End Select If strSearchChr = 0 Then Me.FilterOn = False Else Me.Filter = "[Name] LIKE '" & strSearchChr & "*'" Me.FilterOn = True End If "Mojo" wrote in message ... Does anyone know how to add Alpha search button on a form? For example, I have a list of 600 names in my table, what I want on the top of my form is alphabets A-Z and when someone clicks on any letter, all the names starting with that letter show up. Can anyone help me? Thank you for your time. |
#3
|
|||
|
|||
"Simon Maystre" wrote in message
... I maanged to do this by using an option group with A-Z and an All button as well and use the code below to restrict the list to the relevant names: How about strSearchChr = Chr(64 + SearchOption) Tom Lake |
#4
|
|||
|
|||
Hey lot smarter than my solution, will update mine now!
Cheers Simon "Tom Lake" wrote in message ... "Simon Maystre" wrote in message ... I maanged to do this by using an option group with A-Z and an All button as well and use the code below to restrict the list to the relevant names: How about strSearchChr = Chr(64 + SearchOption) Tom Lake |
#5
|
|||
|
|||
I can see what you want to do, but might I suggest an alternative, to have
a combo box and 'Filer button'. Do the same as is suggested above, but with the values being in a combo box instead. Doing it this way will reduce the number of controls from 28 controls (26 option buttons, 1 frame and 1 All option) down to just 2 controls. There are two real benefits he 1. Less space taken up on your form (nobody likes to see hundreds of controls on any form) 2. Takes up less memory - each control takes up a small amount of memory, and therefore affects the speed in which your form loads. whilst I know this is not the solution you wanted, it is what I would do, and have in the past. Cheers John Webb -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
Mojo
Take a look in the Customer Phone List in the northwind sample database there is a nice solution too Herman "Mojo" wrote in message ... Does anyone know how to add Alpha search button on a form? For example, I have a list of 600 names in my table, what I want on the top of my form is alphabets A-Z and when someone clicks on any letter, all the names starting with that letter show up. Can anyone help me? Thank you for your time. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search by Query and populate my form | Big Tom Tuttle | Running & Setting Up Queries | 1 | March 23rd, 2005 09:30 PM |
Copy form data to a table | Gunner | General Discussion | 5 | January 24th, 2005 08:53 PM |
Need to clear controls of Filter form | Jan Il | Using Forms | 2 | November 28th, 2004 02:04 PM |
Display Parameter from Form on Report | sara | Setting Up & Running Reports | 10 | July 19th, 2004 04:54 PM |