The information in this article applies to:
- Microsoft Access versions 7.0, 97
SYMPTOMS
Novice: Requires knowledge of the user interface on single-user computers.
When you import a Microsoft Access object from one database into another
database, any reference used by the object is not imported, and you must re-
create the reference in the target database. For example, if you insert an
ActiveX control on a form, Microsoft Access automatically creates a
reference to the .OCX file for that control. If you then open another
database and import the form that contains the ActiveX control from the
first database, the reference to the .OCX file is not imported with the
form. This behavior also occurs when you export an object.
CAUSE
A reference is not imported or exported with an object because it is not
specific to the object; instead, a reference is specific to the project of
a database.
RESOLUTION
To re-create the reference, you can use one of the following two methods.
You can re-create the reference by adding the library file or .OCX file to
the Available References list. Or, you can re-create a reference to an .OCX
file by inserting the corresponding ActiveX control on a form.
Method 1
To add the library file or .OCX file to the list of available references in
the target database, follow these steps:
- In the target database, open a new module.
- On the Tools menu, click References.
- In the References dialog box, scroll down the Available References and
select the check box for the library file or .OCX file to which you
need to re-create the reference. If the file doesn't appear on the list,
click Browse, locate the file in the Add Reference dialog box, and then
click OK.
Method 2
When you insert an ActiveX control on a form, Microsoft Access
automatically creates a reference to the .OCX file that corresponds to the
control, even if you don't save the form. This method is useful if you do
not know the name of the .OCX file of the ActiveX control. To re-create a
reference to the .OCX file of an ActiveX control, follow these steps:
- In the Database window, click the Forms tab, and then click New.
- In the New Form dialog box, click Design View, and then click OK to
create a new form.
- On the Insert menu, click ActiveX controls (or Custom Controls if you
are using Microsoft Access version 7.0).
- In the Insert ActiveX control dialog box (or the Insert Custom Controls
dialog box if you are using Microsoft Access 7.0), select the ActiveX
control to which you want to create a reference. Then click OK.
- On the File menu, click Close. When prompted to save the form, click No.
MORE INFORMATION
By default, a new Microsoft Access 97 database contains references to the
following libraries:
Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft DAO 3.5 Object Library
By default, a new Microsoft Access 7.0 database contains references to the
following libraries:
Visual Basic for Applications
Microsoft Access for Windows 95
Microsoft Jet SQL Help Topics
Microsoft DAO 3.0 Object Library
Steps to Reproduce Behavior
- Start Microsoft Access and open the sample database Northwind.mdb.
- In the Database window, click the Forms tab, and then click New.
- In the New Form dialog box, click Design view, and then click OK to
create a new form not based on any table or query.
- On the Insert menu, click ActiveX controls (or Custom Controls if you
are using Microsoft Access version 7.0).
- If you are using Microsoft Access 97, click Calendar Control 8.0 on the
list in the Insert ActiveX Control dialog box, and then click OK. If
you are using Microsoft Access version 7.0, click Calendar Control on
the list in the Insert Custom Controls dialog box, and then click OK.
- On the File menu, click Save. In the Save As dialog box, type
"frmRefTest" (without the quotation marks) in the Form Name box.
Click OK.
- On the File menu, click Close to close the form.
- In the Database window, click the Modules tab. Click New.
- On the Tools menu, click References. In the References dialog box,
note that the check box of the Calendar Control is selected. Click
Cancel.
- On the File menu, click Close. Click No if you are prompted to save the
module.
- On the File menu, click Close to close the database Northwind.mdb.
- On the File menu, click New Database.
- In the New dialog box, click the Blank Database icon on the General
tab. Click OK.
- In the File New Database dialog box, accept the default database name
that appears in the File Name box, and then click Create.
- On the File menu, point to Get External Data, and then click Import.
- In the Import dialog box, locate the sample database Northwind.mdb and
double-click it.
- In the Import Objects dialog box, click the Forms tab, select
frmRefTest in the list of forms, and then click OK.
- In the Database window, click the Modules tab, and then click New to
create a new module.
- On the Tools menu click References. Note that there is no reference to
the Calendar Control. Even if Calendar Control appears in the list, its
check box is not selected.
|