Where is recordsource property in access
Changing the record source of an open form or report causes an automatic requery of the underlying data. If a form's Recordset property is set at runtime, the form's RecordSource property is updated. After you have created a form or report, you can change its source of data by changing the RecordSource property. The RecordSource property is also useful if you want to create a reusable form or report.
For example, you could create a form that incorporates a standard design, and then copy the form and change the RecordSource property to display data from a different table, query, or SQL statement. Limiting the number of records contained in a form's record source can enhance performance, especially when your application is running on a network. For example, you can set a form's RecordSource property to an SQL statement that returns a single record and change the form's record source depending on criteria selected by the user.
The following example sets a form's RecordSource property to the Customers table. The next example changes a form's record source to a single record in the Customers table, depending on the company name selected in the cmboCompanyName combo box control. If the fields you need are contained in two or more tables, you will need to make sure that the tables can be joined logically on some kind of common value, and then create a named query or an embedded query to use as the record source.
A named query — usually just called a query — is a query that has been saved as a database object. You can use a named query as a record source for multiple forms or reports.
However, changes to the query design will affect all forms and reports that use it as a record source. An embedded query is a query that is stored in the Record Source property of another object.
Embedded queries are created by default when you use the Report Design , Blank Report , or Labels tools, described in the next section. Embedded queries are also created by the Report Wizard, provided that you select data from more than one table for your report. If you only select data from one table, the Report Wizard binds the report directly to that table.
To open a named query in SQL View:. Right-click the query in the Navigation Pane, and then click Design View.
To create a report in Access, you click one of the tools in the Reports group of the Create tab. Depending on how you use the tools, each one creates one of the three record source types described in the preceding section.
The following table describes what each report tool does, and what record source types are created by default. Embedded query, if you drag fields from the Field List task pane to the report. You can also select a table or named query from the Record Source drop-down list in the Property Sheet. Opens a blank report in Layout view, and displays the Field List task pane.
As you drag fields from the Field List to the report, Access creates an embedded query and stores it in the Record Source property of the report. The wizard creates a report based on the selections you make. Embedded query, if you select fields from more than one table. If you only select fields from a single table, Access uses that table as the record source. Displays a wizard that lets you select standard or custom label sizes, as well as which fields you want to display, and how you want them sorted.
The wizard creates the label report based on the selections you make. For more information about web databases, see the article Edit or publish a web database site on SharePoint. Any report that is bound to a table or named query can be modified so that it is bound to an embedded query instead. As mentioned earlier, this can make a database easier to maintain by making reports more self-contained, and less dependent on other objects. Depending on your current record source type, use one of the following methods to convert it to an embedded query:.
If the Record Source property is a table name, you can quickly create an embedded query by clicking the Build button in the Record Source property box.
In the Navigation Pane, right-click the report you want to modify, and then click Layout View. On the All tab, click in the Record Source property box, and then click the Build button. Access asks if you want to create a query based on the table. Click Yes to continue. Access opens the Query Builder and adds the table that was originally in the Control Source property.
Add fields to the query grid by double-clicking each field name that you want on the report. This must be done for all fields that you want to be displayed on the report.
Make sure the tables and queries you add are joined in a logical way. For example, the ID field of the Customer table would likely have a join line connecting it to the CustomerID field of the Orders table. You can create join lines by dragging a field name from one table or query to a field name in another table or query. For more information about creating queries, see the article Introduction to queries.
Scalability 4. Benefits 3. Tables 2. New Database 1. Form Concepts 1. Relational Data 1. Parent child relationship 1. Queries 1.
0コメント