[AccessD] Search as you type

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Wed Apr 20 11:14:14 CDT 2011


Hi Doug --

I suppose you can try to use KeyDown event and run search only when {Enter}
or any other special char(s) combination is pressed.

Private Sub txtSearch_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    MsgBox (txtSearch.Text)
    ' suppress if needed => KeyCode = 0 
  End If
End Sub


Thank you.

--
Shamil
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Steele
Sent: 20 ?????? 2011 ?. 19:29
To: Access Developers discussion and problem solving
Subject: [AccessD] Search as you type

I've built a form with a live search box so that a client can enter any text
to search (on one field only) and the form redisplays with the matching
records.  My first attempt is to use the 'OnChanged'
event in the search text box and re-filter the form using a filter "Name
like '*xxxx*'.  This works well enough on my local machine, but on the
client's network there is an annoying pause after each character is typed.
My ideas on speeding this up are:

1. Only re-filter when the typing pauses for, say, half a second.
Usually a search is done by entering a few characters quickly, like 'Bill',
then waiting to see the results.  I can't quite figure out how to do this,
though.
2. Use ADO for the form recordset, to avoid network traffic.

Any suggestions?

Thanks,
Doug
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list