Create a search window

M

MackBlale

How do I create a search window in my form that will allow the user to
search records by Client ID, Name, passport number, etc? This is for an
employee database.
 
L

Larry Linson

MackBlale said:
How do I create a search window in my form that
will allow the user to search records by Client ID,
Name, passport number, etc? This is for an
employee database.

If you only search on a few Fields, a common approach is to include a Combo
Box in the Form's header, and let the Combo Box Wizard "write the code" for
you, where the Detail of the Form has a Record Source of the Query or Table
whose data you wish to display.

If you wish to search on any Field in the Record, you could have two Combo
Boxes, the First identifying the Field, and the Second for entering
criteria. This would require more programming "behind the scenes" to reset
the Row Source of the combo used for criteria when the Field is selected.

Larry Linson
Microsoft Office Access MVP
 
M

MackBlale

Larry,
I think the first option will suffice. Can you give me detailed instructions
on what this should look like?

Mack
 
L

Larry Linson

MackBlale said:
I think the first option will suffice. Can you
give me detailed instructions on what this
should look like?

I don't think I can do a better job than the Combo Box Wizard -- have you
given it a try?

In Access 2003 or earlier:

Create a form with the Table or Query you want as its RecordSource (for
learning purposes, you can select the Table or Query and click AutoForm on
the Tool Bar.

If the Form Header is not showing, in Design View of the Form, on the menu,
click View | Form Header / Footer. Make sure the "magic wand" is selected
in the ToolBox (by default, that'll be anchored to the left in Design View,
then click on the Combo Box icon.

Click in the Form Header, and the first dialog box of the Wizard will pop
up. Pick the last of the three options, "Find a record on my form based on
the value I selected in my combo box."

A really good book for someone asking questions at this level is "Microsoft
Access <version number> Step by Step" from Microsoft Press. A good, free
tutorial by MVP Crystal Long can be found at
http://www.accessmvp.com/Strive4Peace/Index.htm.

Larry Linson
Microsoft Office Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top