Enable users to find a record by selecting a value from a list
When you design a form in Access, you can create a list box or a combo box that can be used to find a record when a value is selected from the list. This makes it easier for users to quickly find existing records without having to type a value into the Find dialog box.
- For this procedure to work, the form must be bound to a table or a saved query. Step 5 of the procedure contains more information about what to do if this is not the case.
- This procedure might create code that will run only when the database is granted trusted status. For more information, see the article Decide whether to trust a database.
Create the list box or combo box
- Right-click the form in the Navigation Pane, and then click Design View.
- On the Design tab, in the Controls group, ensure that Use Control Wizards
- Click Cancel to close the wizard.
- Right-click the list box or combo box that you created earlier, and then click Delete.
- If the Property Sheet task pane is not displayed, press F4 to display it.
- Select Form from the list at the top of the property sheet.
- On the Data tab of the property sheet, look at the Record Source property box. This box must contain the name of a table or saved query before you can use the procedure described in this article. If the box is blank, you can select an existing table or query as the record source, or you can create a new query to serve as the record source. If the box contains a SELECT statement, you have the additional option of converting that statement to a saved query. Once you have completed one of these tasks, the next time you run the Combo Box/List Box wizard, it will display the Find a record. option. Follow one of these procedures based on what you want to do:
- Select an existing table or query as the record source
- If you know that there is an existing table or query in your database that contains the records you want to find, use this procedure to bind the form to that object.
Note: If the Record Source property box contains a SELECT statement, following this procedure will delete that statement permanently. You might want to copy the statement to a text file or other word processing program in case you want to restore it.
- You can begin creating a new query. For more information, see the article Create a simple select query. When you are finished building the query, proceed with step 2.
- If the Record Source property box originally contained a SELECT statement, that query is displayed in the Query Builder. Proceed with step 2 to convert it to a saved query.