Keeping References Automatically Selected

BPlenge

Registered User.
Local time
Yesterday, 19:14
Joined
May 14, 2007
Messages
10
I have a database with forms that use ADO to access data files. In the design stage, I went into Tools/References and checked "Microsoft ActiveX Data Objects 2.1 Library", which made the ADO work.

For each “case” that is run, the application creates a separate database and copies all forms, reports, etc into it. In Access 2003, the forms in the new database still have "Microsoft ActiveX Data Objects 2.1 Library" checked, but when I run the application in Access 2007, the forms do not have "Microsoft ActiveX Data Objects 2.1 Library" checked, and the ADO will not work until I go in and manually check it myself.

Does anyone know why the selected references do not carry over in 2007, and how to keep them automatically selected when forms are copied into a new database?

Thanks so much.
 
I have a database with forms that use ADO to access data files. In the design stage, I went into Tools/References and checked "Microsoft ActiveX Data Objects 2.1 Library", which made the ADO work.

For each “case” that is run, the application creates a separate database and copies all forms, reports, etc into it. In Access 2003, the forms in the new database still have "Microsoft ActiveX Data Objects 2.1 Library" checked, but when I run the application in Access 2007, the forms do not have "Microsoft ActiveX Data Objects 2.1 Library" checked, and the ADO will not work until I go in and manually check it myself.

Does anyone know why the selected references do not carry over in 2007, and how to keep them automatically selected when forms are copied into a new database?

Thanks so much.

References aren't form or module level, they apply to the entire database. Since you are creating a new database and copying object into it, the new database has whatever default references are set. In 2003 this was ADO, in 2007 Microsoft changed to DAO as the default (which was also the default in 2000 if I'm not mistaken). You could add code to a module or a form that is called when the database is started and add the references using this.

Code:
Application.References.AddFromFile

There is also the option of eliminating the need for references by using the create object method instead of declaring an explicit object type.
 

Users who are viewing this thread

Back
Top Bottom