Use a query as the record source for a form or report

You can use a query to supply data to a form or report. You can use a query when you create the form or report, or you can change an existing form or report by setting its Record Source property. When you set the Record Source property, you can either specify an existing query, or you can create a new query to use.

If you use a query as the record source, you might not be able to edit the data. Before you use a query as your record source, you should consider whether you need to edit data.

This article explains how to set the Record Source property for an existing form or report, and provides information about when you can and cannot edit query data.

This article does not explain how to create a form or a report. For help creating forms and reports, see the articles Roadmap to creating a form and Create a simple report.

In this article


Use an existing query as the record source of a form or report

In Design view, set the Record Source property to an existing query that you want to use.

  1. Open the form or report in Design view.

If the property sheet is not already open, press F4 to open it.

  1. In the property sheet, on the Data tab, click the Record Source property box.

The Record Source property on the Data tab.

  1. Do one of the following:
  • Start typing the name of the query that you want to use.

Access automatically fills in the name of the object as you type.

- or -

  • Click the arrow and then select the query that you want to use.

Top of Page Top of Page

Create a query as the record source of a form or report

In Design view, use the Build button (Button image ) in the Record Source property box to create a new query to use as the record source.

  1. Open the form or report in Design view.

If the property sheet is not already open, press F4 to open it.

  1. In the property sheet, on the Data tab, click the Record Source property box.
  2. Click Button image.

The Build button on the property sheet.

A new query opens in Design view.

  1. Design the query, and then save and close it.

For help designing a query, see the article Select data by using a query, and the See Also section.

Top of Page Top of Page

Editing data from a query

One of the main reasons you use forms is to enter and edit data. Some queries do not support data editing. Before you use a query as the record source for a form, you should consider whether you can edit the query data.

When can I edit data from a query?

You can edit the data from a query if:

 Note   Even when you can edit data in a query, some of its fields may not be available for editing. Such cases are listed in the following section.

When can I not edit data from a query?

You cannot edit the data from a query when:

Top of Page Top of Page

 
 
Applies to:
Access 2007