Automation Error w/ Objects

T

Trent Argante

Hi,
RE: Access 97
I get an Automation Error anytime I try to use an object
in code. I've "Repaired" the database via
the "Tools|Database Utilities|Repair Database" option, but
it has not affected this error.
Anyone got a clue about this?
TIA
Trent
 
S

solent

Hi,

OK sounds like a Missing Reference.

If you go into Design Mode on one of your modules and select Tools /
References from the menu, you can check for missing reference which
could be the cuase of this error.

Or, could you let us know what object you are tryng to automate.

Mark
 
T

Trent Argante

Hi Mark,
This sounds promising.
I am trying to use the following objects:
Database, TableDef, RecordSet, Field, etc.
My first line of code is:
Dim dbs As Database
It errors with "dbs As Database" highlighted.

I have the following References:
Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft DAO 3.51 Object Library

What do you think?
Trent
-----Original Message-----
Hi,

OK sounds like a Missing Reference.

If you go into Design Mode on one of your modules and select Tools /
References from the menu, you can check for missing reference which
could be the cuase of this error.

Or, could you let us know what object you are tryng to automate.
 
K

Ken Snell

From info posted previously by Douglas Steele:

Your references are probably messed up.

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

For far more than you could ever want to know about this problem, check out
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 
T

Trent Argante

Mark & Ken,
I don't really think it's an error directly related to
automation because it occurs with ANY object that I try to
declare (i.e., on the "Dim" line). I think the error was
built into the database itself long ago by my ineptitude
at the time.
I have another database, in the same directory, that has
the same References, that links to this database, that has
no problem using objects. In fact, at times, as a work
around, I use the this database to run object utilizing
macros on the linked tables in the target database. But,
this only goes so far...
(FYI: There are no circular links in either of the
databases' table relationships.)
Trent
 
K

Ken Snell

Then I would suspect that this database is corrupted. Create a new database
and import all the objects into the new database.
 
T

Trent Argante

Hot diggity dog!
That dig the trick!
Thanks a lot, Ken. This "demon" has been persecuting me
for over 3 years now.
The database not only can use objects in macros again, but
I was also able to get rid of a form that just would not
delete (would reply with a "Save operation failed" error).
And it runs much faster now. It also decreased in size a
couple of MB. But, everything got imported, and all test
runs have been successful.
Thanks again!
Trent
 
K

Ken Snell

You're welcome.

Trent Argante said:
Hot diggity dog!
That dig the trick!
Thanks a lot, Ken. This "demon" has been persecuting me
for over 3 years now.
The database not only can use objects in macros again, but
I was also able to get rid of a form that just would not
delete (would reply with a "Save operation failed" error).
And it runs much faster now. It also decreased in size a
couple of MB. But, everything got imported, and all test
runs have been successful.
Thanks again!
Trent
 

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