Queries

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

Guest

Need help in developing a query that will select records as I type in the
letters. For example if I type in the letter "S" the records will be sorted
for the letter "S". If I type in another letter like "E", then the records
are sorted with the first two letters, "SE". I am designing a data base for
about 50,000 records. And need to design this to help the people in the
office that will be using the DB.
 
Need help in developing a query that will select records as I type in the
letters. For example if I type in the letter "S" the records will be sorted
for the letter "S". If I type in another letter like "E", then the records
are sorted with the first two letters, "SE". I am designing a data base for
about 50,000 records. And need to design this to help the people in the
office that will be using the DB.

A bit of jargon, first. The term "Sort" means "take a set of records
and display them in a particular order". It is NOT synonymous with
"search" or "select"!

If you won't have any more than 50,000 records - 65536 is the absolute
limit - you can use a Combo Box based on the table. Typing the first
letter will jump to the first name beginning with that letter, just as
you propose.

However, that's a big table for a combo box. You might instead want to
have an unbound Textbox on your form (and yes, you must use a form for
this; table datasheets are not useful for this purpose). In the
textbox's Change event you could put code like this:

Private Sub txtFind_Change()
Me.FilterOn = False
Me.Filter = "[Namefield] = " & Chr(34) & Me!txtFind & "*" & Chr(34)
' this will generate a filter clause like [Namefield] = "SE*"
Me.FilterOn = True
End Sub


John W. Vinson[MVP]
 
Back
Top