Search field

K

Kutest

I have a really simple database.. that i want to add a field on my main form
that would search through my contact info and lookup a certain name... kinda
like a search box... i tried a code from another person but it didnt work.
if anyone can give me a few options that could possibly help that would be
great!

Thanks in advance
 
J

Jeff Boyce

If you don't tell us what you tried, you might get the same suggestion all
over again.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

Kutest

This is what someone else suggested and that's all that i have tried but it
keeps saying bound to cbNameSearch... because it's inthe Row source..
Like i said before, that im not really familiar with code-modules so if
anyone could help me that would be great! and be as detailed as possible.
Thanks


On your form
Create a Combo Box and name it cbNameSearch
Row Source type for cbNameSearch = Table/Query
Row Source – use the SQL Statement – Query Builder. Now insert the fields
that you want.
For your Column Widths you may want to use something like 0â€;1.4â€;1†if you
don’t want to see the first column.


The following code goes in to AfterUpdate


Private Sub cbNameSearch_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[TipID] = " & Me![cbNameSearch]
Me.Bookmark = Me.RecordsetClone.Bookmark
DoCmd.GoToControl "ReportID"
Me!ReportID.SelStart = Me!ReportID.SelLength ' This takes the cursor
to the end of the name.
End Sub

Of course TipID and ReportID are names that I have assigned to fields. Also
my may not want the last line - Me!ReportID.SelStart =
Me!ReportID.SelLength
 
J

Jeff Boyce

What fields did you use in the SQL Statement-Query Builder?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

Kutest

I tried ContactLastName and ContactFirstName... I would like it to search
through the customers table and find a specific person. Like i type in
someones name and it gives me a list of people with that name and then i can
see which one is right or something similar...
 
Top