Microsoft Office Tutorials and References
In Depth Information
Linking a form to a query
Link a form to a table or query
8 In the Expression Elements pane, browse the tree of information to
locate the form that you created in earlier steps. (If you have many
forms and you know that the form you are looking for is open,
select Forms; then select Open Forms to display only a list of forms
that are open. This is particularly useful when you are referencing
controls on subforms.) Select the form.
9 Double-click the text control that we added to that form. Click OK.
10 Save and then close the query. Return to your form in Design view,
and repeat steps 2–5 of the previous task (“Create an embedded
macro to open a form” on page 222), where we added a command
button to the form and displayed the macro design tool for the On
Click event on the command button. However, this time choose the
macro command OpenQuery in step 5.
11 From the available list of queries, select the query that you saved.
Then save and close the macro window. You will now have a form
with a control into which you can type a value and a button that
opens a query that filters the data by the choice you have typed
into the control.
TIP You can enhance this method by adding a Requery macro
command, which will update the query after you make a change
in the text box on your form without the need to close the query
TIP The symbol ! is part of the syntax used to refer to objects
inside a collection. Therefore, the syntax in this example
translates to “look in the Forms collection for a form, and then look in
that form’s Controls collection for a control.”
Search JabSto ::

Custom Search