473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Any ideas how to emulate googles instant search in access?

Has anyone tried to emulate the google instant search in microsoft access using a little bit of vba?

I tried doing so using a form with a text box and a list box.

I used the text boxes on change event to run this code

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtSearchName_Change()
  2.     Dim strSQL As String
  3.  
  4. strSQL = "SELECT tblUsers.UserKey, tblUsers.DisplayName " & vbCrLf & _
  5.         "FROM tblUsers " & vbCrLf & _
  6.         "WHERE (((tblUsers.DisplayName) Like ""*""+ '" & Me.txtSearchName & "' +""*""));"
  7.  
  8.     Me.lstUserSearch.RowSource = strSQL
  9.     'Debug.Print Me.lstUserSearch.RowSource
  10. End Sub
  11.  
the code does work but not very consistently.
There is a few second lag before the list box updates again. When i debug.print the sql string it doesnt change with every letter entered :-(

Anyone have any ideas?

Thanks in Advance for your help!
Mar 4 '11 #1

✓ answered by Rabbit

Fieldname.text instead of fieldname.value

6 3696
Rabbit
12,516 Expert Mod 8TB
The change event doesn't trigger everytime you press a key. It usually triggers after the field loses focus. The closest you can get is the key up event. You would have to use the Text property of the field.
Mar 4 '11 #2
Thanks for the quick reply!

I tried using the key up event and that works great but for some reason the queries where criteria still doesn't update with every key stroke.

What do you mean by I have to use the text product of the field?

Thanks
Mar 5 '11 #3
Rabbit
12,516 Expert Mod 8TB
Fieldname.text instead of fieldname.value
Mar 5 '11 #4
Thanks Rabbit!
That solved my problem. It searches everytime a new letter is entered and works great.
Mar 7 '11 #5
TheSmileyCoder
2,322 Expert Mod 2GB
Just a short addon from me:
When using Me.txtSearchName you are in most cases actually refering to the default property of that control which is the .Value
Mar 7 '11 #6
That makes sense!
I'll have to remember that for next time cause i have some accross a similar problem in the past!

Thanks again :-)
Mar 8 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: nunya | last post by:
I am trying to do a simple search on a VB form for a access database record. Can anyone help?
2
by: khan | last post by:
hi guys, I want to search query through a webpage. I want to set search criaria a web text filed same we do for forms {forms]!!. is it possible I could use a webpage text field as a search...
3
by: Larry Rekow | last post by:
I've built various web apps using Frontpage and/or ASP and Access, but now I'm trying to figure a way to do the following, perhaps in ASP.Net My friend gets parts lists in invoices (they are in...
3
by: Henners | last post by:
Hi There We are migrating our network file system from Novell to Windows. (There are pros and cons).... In this process, we have noticed that a good bunch of user created access databases...
21
Dököll
by: Dököll | last post by:
Greetings Again, All! I know a bit more of the back end of things than front. Every now and then I use wildcard to retrieve data via sql advantage, oracle, and of course, our beloved MS Access...
1
by: manf442 | last post by:
I have a customer table and form in access 2000. When I want to enter in a customers name, I am uncertain if that customer has already been entered. I want to have a field that I can type in the...
13
by: Vai2000 | last post by:
Hi All, Planning to call the same search API which windows Search uses for searching , when u launch with Ctrl+F,you have the flexibility to provide a containing text! VB/C# any thing would work...
1
by: pontypete | last post by:
Hi all Ive managed to create an ASP & ACCESS local site/databse, Now the aim: Membership Number = 1 Fname = Peter ^ everything in the databse, I want to beable to have a search box within...
3
by: abdull07 | last post by:
Assalam alaycom"Hello" Hello everybody, I have a problem in searching the database using certain date. The probem is how I can convert the date from textbox to be used by vb code to match dates in...
2
by: Tom | last post by:
Hi All I'd like to create a half decent looking form entry and search database for a few hundred DVDs. I've tried this myself and found doing it difficult so I'm just using a simple form for the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.