Search field

C

CAM

Hello,

In my form I want to have a search box looking for two fields in particular.
One field is the Auditors Name and the second field is the Audited Date.
For example the user will type example below into a search boxes:

Auditors Name Audited Date
John Doe 9/22/06

The resulting record will show the above . I want a way so I can input in
the search box the two fields and get the results instead of scrolling for
the Auditor. I don't know how to code this. Any tips or website to visit
will be appreciated. Thank you.

Regards,
 
T

tina

for a search form using multiple criteria, i usually create a form bound to
the table or query that i want to search, set to Datasheet view or
Continuous Forms view. then i create an unbound form, and add an unbound
textbox or combo box control for each field i want to apply criteria to. i
add the bound form as a subform in the unbound form. then i change the
RecordSource of the subform to a SQL statement, with criteria on each field
i want to search. for instance, to allow the user to search by AuditorsName
*or* by AuditedDate *or* by both, set criteria on the AuditorsName field in
the SQL statement, as

[Forms]![UnboundFormName]![TextboxControlName] Or
[Forms]![UnboundFormName]![TextboxControlName] Is Null

the above goes all on one line in the "query" design view of the
RecordSource property. use the same syntax to set criteria for the
AuditedDate field.

i usually add to two command buttons to the unbound main form: a Search
button with code that simply requeries the subform, and a Clear (or Reset)
button the sets the value of the each unbound "criteria" control on the main
form to Null (you can also requery the subform with this button, so that all
records show again).

hth
 

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