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
"CAM" <alex_martinez[ at ]comcast.net> wrote in message news:OA4YEfD5GHA.3376[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text] > 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, > >
|