Alphalist

Vassago

Former Staff Turned AWF Retiree
Local time
Yesterday, 19:47
Joined
Dec 26, 2002
Messages
4,696
I am trying to create a database of software that I own. On a form, I would like to create an alphalist across the top so that, when a user clicks on a letter, it brings up the coinciding subform. What is the best code to use for this? Any help would be greatly appreciated. I want it to be kind of like the members page on this web site, with the user choosing a letter of the alphabet and the subform filtering only those programs that begin with that letter.

Thanks,
 
Was the wording off? I'm sorry if it was. Basically, I just want the alphabet posted across the top, like in the header section of a form, and if the user chooses a letter, it will narrow the results to only those programs beginning with that letter. If it can behave much like the <members> section above in this forum, it would be great.

Thanks,
 
Vassago,

The easiest way would be to make 26 unbound text boxes
with default value the desired letter. Using the OnClick
event set the form's rowsource to:

Forms![MyForm].RowSource = "Select * From MyTable " & _
"Where KeyField Like 'A*'"
Forms![MyForm].Requery
Forms![MyForm].Refresh

The drawback with this approach is that you need to have
26 individual Select statements.

If you named the controls "A" thru "Z" then the OnClick
could just call one function that did something like:

Forms![MyForm].RowSource = "Select * From MyTable " & _
"Where KeyField Like '" & Me.Form.ActiveControl.Name & "*'"
Forms![MyForm].Requery
Forms![MyForm].Refresh

hth,
Wayne
 
There's a sample of this Alpha search in the Northwind database.

Failing that - I can knock up a sample for you. I have used this quite alot in my databases.

Col
:cool:
 

Users who are viewing this thread

Back
Top Bottom