By using a Combobox for each Field you want to use to search on. The Combobox Wizard will do most of the heavy lifting for you:
If you haven't already done so, create a form based on your table or query, including all the fields you want displayed. Then simply:
- Add a Combobox to your Form.
- The Combobox Wizard will pop up
- Select "Find a record based on the value I selected in my combobox."
- From the Table or Query the Form is based on, click on the Field you're searching by (a Field that is unique for each Record) to move it to the right side.
- Hit Next.
- Size the column appropriately.
- Hit Next.
- Name the Combobox something appropriate.
- Hit Finish.
Now you can drop the Combobox down and scroll down to the item to search by, or you can start to enter the item, and the Combobox will "autofill" as you type. Hit <Enter> and the record will be retrieved.
If you want the Form to be blank when it first opens, use this code to move to a New Record:
Code:
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007