Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

searching databases

searching databases

searching databases

How can I search through a database in a specific field like is done when you go to windows help-index window. I want to see possible matches as I type in the string.

RE: searching databases

One way to do it is with the text_change() event, put a code to look like:

private sub text1_change()
dim s as string
s = "fields = " & text1.text
with dat.recordset
.findfirst s
if .nomatch then .movefirst
end with
end sub

RE: searching databases

hug & milner -

I saw this being done in Bell South's "Yellow Pages on CDROM". God, what a dog. It hit the disk every time you would enter a keystroke. Even on a 24x CDROM I'd fall asleep.

It's probably an OK technique as long as the database is on a local hard drive, and the query is very focused, and the table is small, and you're going against the primary key.

Chip H.

RE: searching databases


I have seen this being done via a combo/list box. Populate the combo, then use the windows api to search, its a simple piece of code and very fast. I'll try to dig it up.


RE: searching databases

I think that I would agree with Chip - this could be rather slow unless you're searching through a small amount of data.

You could try speeding it up by reading the data into an array and searching through that on the change event... Depends upon how much data you have to deal with and on the speed of the PC doing the search.



RE: searching databases

Banging on the database in a multi-user network is a big problem here. Like Mike, we load an array during form activate. Only with the search field and corresponding record key.

Users expect the good stuff they see with shrink wrapped single user packages. It's a genuie challange to include some of it in multi-user apps without wrecking response times.


RE: searching databases

I would have to agree with the comments re the api. Look at a windows help file, some of these may have a couple of thousand entries, and as you type it actively searches the list for a match. You could look at setting up a static recordset set for users, write it to the the harddisk and reload it into an a recordset and populate an object (list combo..) and use it to search.

Get any decent reference on ADO and you can see the code to write a recordset to disk. I have used the api and a combo to search through 2000 records and its a fast as a windows help file. However, there is an upper limit to the recordset size for perf!!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close