Error on CurrentDb statement

S

sk

I have a db that errors everytime it hits the CurrentDb statement. the error
is:

Description: Automation error
The specified module could not be found.
Error #: -2147024770

or

-2147024770
Method 'CurrentDb' of object '_Application' failed

This is the first line of code that it happens on:

Set rst = CurrentDb.OpenRecordset(sql)

If I jump past that section of code, it errors on the next line with
CurrentDb in it.

Any help will be GREATLY appreciated.
 
D

DanRoss

Specific Version Information and project type will help (is this an MDB or
ADP project)
 
S

sk

It is a simple Access2003 system. I have a front end with all the code and
forms and linked tables to a Access2003 backend. The system is split to
allow the user (me) to archive data between years.

It was running fine the last time I had it open and I have not made any
changes to the code.
 
F

fredg

I have a db that errors everytime it hits the CurrentDb statement. the error
is:

Description: Automation error
The specified module could not be found.
Error #: -2147024770

or

-2147024770
Method 'CurrentDb' of object '_Application' failed

This is the first line of code that it happens on:

Set rst = CurrentDb.OpenRecordset(sql)

If I jump past that section of code, it errors on the next line with
CurrentDb in it.

Any help will be GREATLY appreciated.

Do you have a reference set to the Microsoft DAO 3.6 Object Library?

Open the VBA editor.
Click on Tools + references
Make sure the
Microsoft DAO 3.6 Object Library
has a check placed in it.

Then either move the DAO reference ahead of the Activex Data Object
library reference, or, in your code, explicitly refer to the DAO
library, i.e.
Dim Db as DAO.Database
Dim rst as DAO.Recordset
Set rst = Db.OpenRecordset(SQL)

etc.
 
S

sk

Fred,

I had it referenced and I moved it up in the stack. The Error did not go
away so I unselected it and closed the References window. Now when I
reselect I get a “Error loading DLLâ€. Now I know what the problem is but how
do I fix it.

FYI I have a new copy of Office Pro2007, could I install it to fix the
problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top