Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Check for updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Taking the mystery out of Name AutoCorrect in Access
 
Applies to
Microsoft Access 2002

In Access 97 and previous versions, if you renamed an object in your database you ran the risk of breaking any objects based on that object. For example, if you renamed a field in a table, any text boxes, queries, and other objects that relied on that field for data would suddenly cease to work or return erratic results. And as it was difficult to determine how many and which objects were bound to a field, it took a considerable amount of work to prevent problems before renaming an object. In the following illustration, the Company Name field is used in several places in the database (1 in a table, 2 as a field in a query, 3 as a text box on a form, 4 as grouping header on a report, and 5 as a banded control on a data access page). Consider the impact to the various objects if the Company Name field in the table was renamed.

A form, report, query, and data access page displaying data from the same table

Starting in Access 2000, the Name AutoCorrect feature was added to automatically correct common side effects that occurred when you renamed forms, reports, tables, queries, fields, text boxes or other controls in an Access database. This feature was enhanced in Access 2002 to correct shortcomings in the earlier version of Name AutoCorrect.

Notes

  • Name AutoCorrect is not available for data access pages.
  • The Track name AutoCorrect info option and Perform name AutoCorrect option are on by default in new databases.
  • The Name AutoCorrect feature is different than the AutoCorrect feature. The Name AutoCorrect feature corrects references between objects. The AutoCorrect feature corrects frequently misspelled words or phrases.

ShowWhat Name AutoCorrect fixes

Name AutoCorrect fixes discrepancies that occur when you rename any forms, reports, tables, queries, or controls on forms and reports. If you create forms or other objects while Name AutoCorrect is turned off, then turn Name AutoCorrect on, Access will fix any new discrepancies as you continue working with the objects. If one of the objects already has a renaming error when you turn Name AutoCorrect on, you will have to fix references to the object manually. For forms or reports that contain Microsoft Visual Basic code, Access repairs references to the form, but does not repair references to objects in the Visual Basic project.

In addition to the features mentioned above, Name AutoCorrect in Access 2002 also supports changes to:

  • Field names in the Sorting and Grouping dialog for reports.
  • Controls bound to columns in a SQL statement. For example, a report using a SQL statement as its record source where the field name of a bound control changes.
  • Field name changes in update or append queries.
  • The last columns in queries with a large number (>150) of columns.

ShowWhat Name AutoCorrect won't fix

Name AutoCorrect doesn't fix references in:

  • A Microsoft Access project.
  • A replicated database. When you replicate your database, Access turns Name AutoCorrect off. You can't turn on Name AutoCorrect in a database Design Master or replica.
  • A converted database (see additional information below).
  • Data access pages, macros, and modules.
  • Desktop shortcuts that open a particular database object.
  • An invalid SQL statement.
  • Microsoft Visual Basic code.
  • A linked table when the table or fields have been renamed in the back end of a front-end/back-end database.
  • The Filter or OrderBy properties of tables, queries, forms, and reports.
  • References to macros in a toolbar or menu, including menu and toolbar properties and event properties that are set to macro names.

ShowHow Name AutoCorrect works

All of the Name AutoCorrect options are accessed via the General tab in the Options dialog from the Tools menu, as highlighted in the following image.

Access Name AutoCorrect options

When you turn on the Track name AutoCorrect info option (located on the General tab in the Options dialog under the Tools menu item), Access opens, examines, and saves each of the objects (tables, queries, forms, reports, etc.) in your database. This allows Access to create a list (also known as a name map) of objects and their dependencies. Then, whenever you open a form or other object, if the Perform name AutoCorrect option is selected, Access automatically looks for and fixes discrepancies between the form and the other objects that the form depends on. For example, if you open a form that is bound to a table, Access compares the date/time stamps for the table and the form. If they are different, Access performs a Name AutoCorrect to detect and correct differences in the names of fields in the table and names of controls on the form. If the Log name AutoCorrect changes option is selected, Access also creates a log of the changes it makes to the database when name errors are repaired. These changes are saved to a table called AutoCorrect Log.

ShowRequirements for using Name AutoCorrect

In order to take advantage of the Name AutoCorrect feature, you must be able to save changes to the form, report, or other object that Name AutoCorrect is fixing. You can save changes to an object if you have permission to modify the design of the object, if you have write access to the database, and if you have exclusive access to make changes. If you can't save the object, the fixes are discarded when you close the object. Name AutoCorrect makes the changes each time that the object is opened but can't save the changes until someone with permissions to modify the design opens and saves the object. You may experience a delay when opening objects if the Name AutoCorrect feature is enabled and you don't have the proper permissions or exclusive access to make the changes. For more information on setting permissions in an Access database or opening the database exclusively, see Access Help.

The logic to create "name maps" is not performed when Name AutoCorrect is enabled programmatically for a specific object. For example, when Name AutoCorrect is enabled in code by the SetOption method, no name map is created. You should initially enable Name AutoCorrect in the Options dialog box on the Tools menu, and then turn it on or off for an object programmatically.

ShowHow to enable Name AutoCorrect

ShowFor your existing database objects

  1. On the Tools menu, click Options.
  2. On the General tab, do one or more of the following:
    • To have Microsoft Access maintain the information it needs to run Name AutoCorrect, but not take any action, select the Track name AutoCorrect info check box.
    • To have Access run Name AutoCorrect as name changes occur in the database, select the Perform name AutoCorrect check box.
    • To have Access keep a log of the changes it makes each time it runs Name AutoCorrect, select the Log name AutoCorrect changes check box. Access saves the changes in a table called Name AutoCorrect Log. Each change is a record in the Name AutoCorrect Log table.
  3. To enable Name AutoCorrect for a table, query, form or report that already exists in the Access database, open it in Design view, save it, and close it.

ShowFor imported or new database objects

Note that if you import or create a database object when Name AutoCorrect is not turned on, Access doesn't have enough information to enable Name AutoCorrect for that object. To enable Name AutoCorrect for the object, do the following:

  1. On the Tools menu, click Options, and then click the General tab.
  2. Select the Track name AutoCorrect info and Perform name AutoCorrect check boxes.
  3. If you want a log of the changes that Access makes to the database when it repairs naming errors, select the Log name AutoCorrect changes check box as well.
  4. Open the database object in Design view, save, and close it.

ShowFor converted Access databases

Name AutoCorrect is enabled by default in databases that were created with Access 2000 or later. To enable Name AutoCorrect in a converted Access database, do the following:

  1. On the Tools menu, click Options, and then click the General tab.
  2. Select the Track name AutoCorrect info and Perform name AutoCorrect check boxes.
  3. If you want a log of the changes that Access makes to the database when it repairs naming errors, select the Log name AutoCorrect changes check box as well.
  4. Open each table, query, form, and report in Design view, save it, and close it.
advertisement