Search box.

Danden

Registered User.
Local time
Today, 14:36
Joined
Jun 10, 2013
Messages
26
Hello,
I would like to make a search box and update my form with the person's data from the search box. Can anybody help me with it?
 
Assuming your person table has a uniqueID, do the following.

On your form, create an unbound combobox, lets call it cboSearch

In the rowsource for cboSearch put

Code:
SELECT ID, PersonName FROM tblPerson ORDER BY PersonName

Other properties to check in your cboSearch are as follows:

Limittolist=yes
boundcolumn=1
columncount=2
columnwidths=0cm;2cm;

In the afterupdate event for cboSearch put:

Code:
Me.Filter= "[ID]= " & cboSearch
Me.FilterOn=True

You'll need to change names to suit you actual naming for tables and fieldnames
 
Thank you for your help. Your example works, but the problem is that I get too long a list of employees (about 200). Is it possible to get key stroke filtering by name, eg. if I type the letter J (John) and get a list of those that start with J, or some other letter.
Do you know is it possible to hide the ID on the list in combox?
 
Do you know is it possible to hide the ID on the list in combox?
Yes - you need to set the column widhts as previously advised

columnwidths=0cm;2cm;

Doing this should also solve this problem
if I type the letter J (John) and get a list of those that start with J, or some other letter.
which will provide you with the 'typeahead' facility
 
Pleased to help - please click on the Thanks! button
 

Users who are viewing this thread

Back
Top Bottom