Video: Set the record source for a form or report
The record source is a table, query, or SQL statement that contains the actual data that is shown on a form or report. A form or report that displays records is said to be "bound" to a record source. If there is no record source, the form or report is said to be "unbound".
In the video
Set the Record Source property of a form or report
Note: Changing the record source of an existing object can make it unusable, so be sure to make a backup of any objects you plan to change.
-
Open the form or report in Layout view.
-
Right-click anywhere on the object, and then click Form Properties or Report Properties, depending on which type of object you are working with.
Access displays the Property Sheet. The Record Source property is available at the top of the All tab. If the Record Sourceproperty is blank, that means the form or report object is unbound. -
Click in the Record Source property box, and then click the drop-down arrow to view a list of tables and named queries.
-
If one of the tables or queries in the drop-down list contains the fields you want to display on the object, select it from the list. If not, select a table that contains some of the fields you want, and then click the Build button to create a query that contains the other tables you need.
Notes
-
If the Record Source property box contains a table name, clicking the Build button enables you to create a query that contains that table. If you want, you can add other related tables to the query.
-
If the Record Source contains a query name or an SQL statement, clicking the Build button opens that query in the Query Builder so that you can edit it.
-
If you create or edit a query to use as the record source, you can either save it as a named query (in which case it will be available for use by other objects in the database), or you can save it as an SQL statement in the Record Source property of the form or report (in which case it will not be available for use by other objects).
To save the query as a named query:-
On the Design tab, in the Close group, click Save As.
-
Type a name for the query, and then click OK.
-
To save the query as an SQL statement in the object's Control Source property:
-
On the Design tab, in the Close group, click Close.
In the dialog box that asks if you want to save the changes made to the SQL statement and update the property, click Yes.
No comments:
Post a Comment