By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,573 Members | 3,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,573 IT Pros & Developers. It's quick & easy.

How do I?

P: n/a
Jon
I have 1400 students in my database. At the moment they are sorted
alphabetically. How do I manage to enter the first letter of a
surname and automatically jump to surnames starting with that letter?

For eg If I type in R then the start of the R's would appear in the
combo box.

Thank you

John
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Open your form in design view, select the combobox, open properties and go to
the Data tab. Set Autoexpand to Yes.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Jon" <da*******@hotmail.com> wrote in message
news:8d**************************@posting.google.c om...
I have 1400 students in my database. At the moment they are sorted
alphabetically. How do I manage to enter the first letter of a
surname and automatically jump to surnames starting with that letter?

For eg If I type in R then the start of the R's would appear in the
combo box.

Thank you

John

Nov 12 '05 #2

P: n/a
With 1400 students in your database, you might want to consider using a technique to delay
populating the combo box until the first one or two letters are entered. Here is a method
that shows how to do this (see the Combo and list box controls section):

http://msdn.microsoft.com/library/de...okChapter8.asp

Tom
______________________________________

"Jon" <da*******@hotmail.com> wrote in message
news:8d**************************@posting.google.c om...

I have 1400 students in my database. At the moment they are sorted
alphabetically. How do I manage to enter the first letter of a
surname and automatically jump to surnames starting with that letter?

For eg If I type in R then the start of the R's would appear in the
combo box.

Thank you

John
Nov 12 '05 #3

P: n/a
Tym
On 17 Dec 2003 12:18:57 -0800, da*******@hotmail.com (Jon) wrote:
For eg If I type in R then the start of the R's would appear in the
combo box.


Assuming that hte alphabetic sort is done on surnmae, and not full
name...

Simple - pupolate the combo box with the surnames (use your own chosen
method here!) then when you view the form, select the combo box, press
R and then the cursor down key and the first R name will be displayed
in the combo box. You can then use the ComboBox1_click event to find
the record which relates to the name displayed, and show the rest of
the record details in other fields on the form.
Nov 12 '05 #4

P: n/a
When you've got 1400 or so names to choose from, a combo box may not be your
best choice of seletion mechanism. Combo boxes use a linear search to do the
auto expand, and this causes noticable degradation of performance for large
lists particularly for names starting with W - Z for example.

What I use in a similar situation is a method you would have seen used by
Outlook Express to filter the thousands of availale newsgroups. The strategy
is to have a text box that acts as a filtering input box, and a standing
listbox (as opposed to the drop-down listbox of a combo) which only displays
name that match the filter, if any.

You would create a "select student" dialog box to carry out rapid selection
of a particular student.
The dialog would have a textbox at the top and a listbox underneath that.
Initially the listbox is populated with all available names but, as letters
are typed into the text box, the list is reduced to names matching the
letters typed, so that the required name eventually comes into view.

The filtering textbox can be easily implemented using its On Change event
like this:

Private Sub FilterText_Change
Dim strFilter As String

If Len(Me![FilterText].Text) = 0 Then
'Show all names
Me![StudentListbox].RowSource = "SELECT [Students].[StudentID], " & _
"[Students].[LastName], [Students].[FirstName]" & vbCrLf & _
"FROM [Students]" & vbCrLf & _
"ORDER BY [Students].[Lastname], [Students].[FirstName];"
Else
'use text typed to filter to reduce contents of listbox
strFilter = Me![FilterText].Text
Me![StudentListbox].RowSource = "SELECT [Students].[StudentID], " & _
"[Students].[LastName], [Students].[FirstName]" & vbCrLf & _
"FROM [Students]" & vbCrLf & _
"WHERE [Students].LastName Like """ & strFilter & "*""" & vbCrLf & _
"ORDER BY [Students].[Lastname], [Students].[FirstName];"
End If
End Sub
"Jon" <da*******@hotmail.com> wrote in message
news:8d**************************@posting.google.c om...
I have 1400 students in my database. At the moment they are sorted
alphabetically. How do I manage to enter the first letter of a
surname and automatically jump to surnames starting with that letter?

For eg If I type in R then the start of the R's would appear in the
combo box.

Thank you

John

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.