Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoExec throws error

Status
Not open for further replies.

VicM

Programmer
Sep 24, 2001
444
US
Hi,

I'm using Access 14 on a Win7 Pro box.

I have a DB (BooksRead) in the accdb format. I wanted to add a startup form to the DB. I've done this before. In fact I have another DB (WorkingDB) that utilizes the AutoExec macro to open with a form.

When I try running the BooksRead DB I get an error (the attached Word doc shows much of what I'm discussing here).

I looked at the References for both DBs and determined that the BooksRead DB did not have the Microsoft Office 14.0 Object Library. When I tried to add it to the references, it wasn't in the list. However, the WorkingDB shows it and doesn't list it as Missing. Because the Reference window is a fixed size, the actual name of the file for that reference is not readable. So when I go to the folder, I don't know which file I should be looking for.

Does anyone have any suggestions as to why the StartApp() works in the WorkingDB and not in the BooksRead DB?

Thx,
Vic
 
 https://files.engineering.com/getfile.aspx?folder=ecf35752-29cb-48f5-8426-74d89c444df4&file=Access14References.docx
Having a reference to the library checked, you can see its path in object browser. Just open the object browser, select library, you should see the path in the bottom pane.

combo
 
combo,
When I open Object Browser in the WorkingDB, I can select the OFFICE library and see the file name is MSO.DLL. But when I open the Object Browser in the BooksRead DB, there is no OFFICE library in the dropdown list.
I then decided to run procexp.exe (process explorer) from the sysinternals suite. I'd also located the MSO.DLL file as being included in the WorkingDB but not in the BooksRead DB.

So I tried to re-register the MSO.DLL using the regsvr32 command. I then got the following error msg:

The module "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\MSO.DLL" was loaded but the entry point DllRegisterServer was not found.
Make sure that "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14" is a valid DLL or OCX file then try again.

I'm stumped.
 
As I understand, in WorkingDB you have reference to Office and it works. VBA in office can use Office library, excel or word have it referenced by default, but not in access. However, you should be able to add it in access via references dialog (access 2016 32 bit vba here), tick the library and accept:
ReferenceOffice_jedrdw.png


Another way to add reference - point the file (browse...) in references. First, find the file and path in properly referenced vba project, next add reference (references dialog) to the file in BooksRead db:
1. References, see the library:
references_qywrpc.png


2. Object Browser check library path and name:
ObjectBrowser_cldy7t.png


3. Return to database without reference to Office and add the reference to file in References dialog.

combo
 
combo,

I don't have the Office 16.0 Object library. Doesn't show up in my references. And don't have any files in the Office16 folder. Hence, no MSO.DLL in that folder.

I'm going to try something else. I'm going to copy the form from BooksRead DB into the WorkingDB. Then I'll change the AutoExec macro to start the form from the BooksRead DB. Hopefully that will work because the references are intact. If that works, I'll clear out all the objects from the copy of the WorkingDB, copy all the other objects from the BooksRead DB into the WorkingDB and rename it.
 
combo,

I actually took your suggestion and was able to navigate to the MSO.DLL in the BooksRead DB references and install it.

I made sure all the references were in the same order as those in the WorkingDB. When I reopened the BooksRead DB I still get the same error that it can't find the StartApp() function in the AutoExec macro. Now I'm really lost.
 
Do you have StartApp() function in the the BooksRead DB? If so is it in the same class type, with the same scope?

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top