Make a replicated database a regular database (MDB)

Microsoft Office Access 2003

Show All Show All

Make a replicated database a regular database (MDB)

Note  The information in this topic applies only to a Microsoft Access database (.mdb).

After you've converted a database into a Design Master, you can't convert it back to its former status as a regular database. However, if you no longer want to use replication and want to decrease the size of a replicated database, you can create a new, regular database that contains all of the objects and data in your replicated database without the additional system fields, tables, and properties associated with replication.

Note  For each table in the new database, create the same index used in the replica table. If the s_GUID is a primary key (and foreign keys in other tables refer to it), you'll want the s_GUID field in the new table. If the s_GUID field is not used as a primary key, there is no reason to preserve it in the new table. Don't copy the s_Lineage and s_Generation fields to the new table.

  1. Create a blank database and open it.
  2. On the File menu, point to Get External Data, and then click Import.
  3. Click the replica that contains the database objects that you want in the regular database, and then click Import.
  4. Click the database objects— except tables— that you want to import into the new database.
  5. Click OK to import these objects.
  6. In the old database, for each table in the replica, create a Make Table Query that takes all the data in the old table and creates a table in the new database with the same data.

    ShowHow?

    1. Create a query, selecting the tables or queries that contain the records you want to put in the new table.

      ShowHow?

      1. In the Database window, click Queries Button image under Objects, and then click New on the Database window toolbar.
      2. In the New Query dialog box, click Design View, and then click OK.
      3. In the Show Table dialog box, click the tab that lists the tables or queries whose data you want to work with.
      4. Double-click the name of each object you want to add to the query, and then click Close.
      5. Add fields to the Field row in the design grid, and if you want, specify criteria and a sort order.
      6. To view the query's results, click View Button image on the toolbar.
    2. In query Design view, click the arrow next to Query Type Button image on the toolbar, and then click Make Table. The Make Table dialog box appears.
    3. In the Table Name box, enter the name of the table you want to create or replace.
    4. Do one of the following:

      Click Current Database.

      Click Another Database, and then either type the path of the database where you want to put the new table or click Browse to locate the database.

    5. Click OK.
    6. Drag from the field list to the query design grid the fields you want in the new table.
    7. In the Criteria cell for the fields that you've dragged to the grid, type the criteria.
    8. To preview the new table before you create it, click View Button image on the toolbar. To return to query Design view and make changes or run the query, click View Button image on the toolbar again.
    9. To create the new table, click Run Button image on the toolbar.

    Note  The data in the new table you create does not inherit the field properties or the primary key setting from the original table.

  7. For each table in the new database, create the same index used in the replica's table.

    ShowHow?

    1. Open a table in Design view.
    2. In the upper portion of the window, click the field that you want to create an index for.
    3. In the lower portion of the window, click in the Indexed property box, and then click Yes (Duplicates OK) or Yes (No Duplicates).
  8. For each table in the new database, create the relationships that existed for the replica's table.

    ShowHow?

    When you create a relationship between tables, the related fields don't have to have the same names. However, related fields must have the same data type unless the primary key field is an AutoNumber field. You can match an AutoNumber field with a Number field only if the FieldSize property of both of the matching fields is the same. For example, you can match an AutoNumber field and a Number field if the FieldSize property of both fields is Long Integer. Even when both matching fields are Number fields, they must have the same FieldSize property setting.

    ShowDefine a one-to-many or a one-to-one relationship

    1. Close any tables you have open. You can't create or modify relationships between open tables.
    2. Press F11 to switch to the Database window.
    3. Click Relationships Button image on the toolbar.
    4. If you haven't yet defined any relationships in your database, the Show Table dialog box is automatically displayed.

      If you need to add the tables you want to relate and the Show Table dialog box isn't displayed, click Show Table Button image on the toolbar.

    5. Double-click the names of the tables you want to relate, and then close the Show Table dialog box. To create a relationship between a table and itself, add that table twice.

    6. Drag the field that you want to relate from one table to the related field in the other table.

      To drag multiple fields, press the CTRL key, click each field, and then drag them.

      In most cases, you drag the primary key field (which is displayed in bold text) from one table to a similar field (often with the same name) called the foreign key in the other table.

      Drag a field from one table to the matching field in the other table.

    7. The Edit Relationships dialog box is displayed. Check the field names displayed in the two columns to ensure they are correct. You can change them if necessary.

      Set the relationship options if necessary.

    8. Click the Create button to create the relationship.
    9. Repeat steps 5 through 8 for each pair of tables you want to relate.

      When you close the Relationships window, Microsoft Access asks if you want to save the layout. Whether you save the layout or not, the relationships you create are saved in the database.

    Note  You can create relationships using queries as well as tables. However, referential integrity isn't enforced with queries.

    ShowDefine a many-to-many relationship

    1. Create the two tables that will have a many-to-many relationship.
    2. Create a third table, called a junction table, and add to the junction table new fields with the same definitions as the primary key fields from each of the other two tables. In the junction table, the primary key fields function as foreign keys. You can add other fields to the junction table, just as you can to any other table.
    3. In the junction table, set the primary key to include the primary key fields from the other two tables. For example, in an Order Details junction table, the primary key would be made up of the OrderID and ProductID fields.

      ShowHow?

      1. Open a table in Design view.
      2. Select the field or fields you want to define as the primary key.

        To select one field, click the row selector for the desired field.

        To select multiple fields, hold down the CTRL key and then click the row selector for each field.

      3. Click Primary Key Button image on the toolbar.

      Note  If you want the order of the fields in a multiple-field primary key to be different from the order of those fields in the table, click Indexes Button image on the toolbar to display the Indexes window, and then reorder the field names for the index named PrimaryKey.

    4. Define a one-to-many relationship between each of the two primary tables and the junction table.
  9. Save your new database.