Change the record source or connection information

Change the record source of a form or report

After you have created a form or report, you can modify its source of data to include or exclude one or more fields, columns, tables, or queries. Changing the record source will change the contents of the field list.

  1. Open the form or report in Design view.
  2. Double-click the form selector or the report selector to open the property sheet.
  3. Do one of the following:

Change the connection information of a data access page

  1. Open the data access page in Design view.
  2. On the Edit menu, click Select Page.
  3. On the property sheet, click the Data tab.
  4. Do one of the following:

    Set or edit the ConnectionString property of the page

    Note   Editing the ConnectionString property of a page that is linked to a connection file will break the link between the page and the connection file.

    Tip

    If you need more room to type the connection string, press SHIFT+F2 to open the Zoom box.

    Specify or change the connection file that the page is linked to

    Note   Microsoft Access will automatically update the ConnectionString property to reflect the new connection information.

    Edit the connection file of the page

    Note   If the page is linked to a connection file, you can edit the contents of the file. Your edits will affect other pages that are linked to the connection file.

    1. In the ConnectionFile property box, click the Build button .
    2. In the Select Data Source dialog box, right-click the connection file, point to Open With, and click Notepad.
    3. Search for "<odc:ConnectionString>" (without the quotation marks) to locate the connection information and make the changes you want.
    4. Save and close the file.
    5. In the Select Data Source dialog box, click OK.

Notes

Change the record source of a data access page section

You can change the record source of a section on an ungrouped page, if the record source that you want to use contains all the fields that are already on the header section. For example, if you add fields from the Order Details table, and then decide to use the Order Details Extended query instead of the Order Details table, you can simply change the property of the header section.

  1. Open the data access page in Design view.
  2. Double-click the section bar of the header section.
  3. In the RecordSource property box, select a record source from the list.

Note   The names of the sections and the ControlSource property of the controls will be automatically updated to reflect the new record source.