Automation Error

Ally

Registered User.
Local time
Today, 15:40
Joined
Sep 18, 2001
Messages
617
Unfortunately when a user opened an Acc'97 db via a shortcut it automatically went to open it in Acc 2000. She clicked Open as opposed to Convert, not realizing that she shouldn't be using it in 2000.

Now, when attempting to open a report (back in Acc '97) - (which runs a query and also uses some code), we now get the error message:

Automation Error

The code that's highlighted is:

Code:
Function getCount(strRs As String)

    Dim r As Recordset
    Dim db As Database
    
    Set db = CurrentDb
    Set r = db.OpenRecordset(strRs)
    
    getCount = r.RecordCount
    
    r.Close

End Function

Does anyone know what's going wrong here please? I haven't a clue. I've check the references and they're the same as they were before.
 
Last edited:
Hello

You could try using DIM r as DAO.r and DIM db as DAO.db making sure that the Microsoft DAO 3.6 object library reference is checked. This cured a similar problem i had.

Chris
 
Last edited:
No Go

Thanks - I tried both: DIM r as DAO.r etc and it came up with "Automation Error" again and changed the text back to what it was.

I also tried changing the "Microsoft DAO 3.51 Object Library" to "Microsoft DAO 3.6 Object Library" and I got "Cannot perform requested operation".

If I tried adding it as well I got "Name conflicts with existing module, project, or object library."
 
Those two libraries are incompatible, so you can't load both of them. 97 works with 3.51, 2K with 3.6.

You can convert an Access 2K database back to 97 though. Look up "conversion" in 2K Help
 
It wasn't converted though - it was only opened in 2000. Should this make so much difference? This problem is occurring in '97.
 
Just a suggestion Ally becuz I don't have A2K but is the DAO library higher in the references than the ADO? That way it should take priority.
 
Sorry, I misread your original post. ADO isn't implemented with Access97, so it won't be that. Just opening a file with A2K doesn't alter it in any way as far as I know. I do it often.What happens if you open it again in A2K? Does it work then?
 
I tried opening again in A2K but it said "Errors loading rpt.. ... Do you want to continue loading the project" about 3x.

Then it said the "Visual Basic for Applications project in the database is corrupt." and won't open it.

I had tried compacting it (in A'97) earlier which I thought had worked as I got sidetracked and didn't realize what had happened, but now realize it didn't and comes up with the message about me not having the permissions to do this. This is ridiculous as there are no permissions / groups / passwords anything on the database.
 
My suggestion as this point would be to create a new database in Acc97, then import all of the objects from the corrupt database. You need to make sure your relationships are imported also. Then do a repair and compact on the new db. Hope this helps!
 
Are you really in St. Paul? :)

Yep, I love livin' and workin' in this "sleepy" little town.
 
Charity: done that and it works to a certain degree - ie, I'm not getting the original error. But now I get an error in one of the macros where it won't open one of the reports. At first the report wouldn't open at all, so I re-created it and it opens fine on its own.

The macro opens two reports, the second one being the one mentioned above. The first one there's no problem, but the second one comes up with the error: "The report name "HeadOfDept...." you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exist."

Now all I need to do it work out why this bit isn't working!

Thanks for your help.
 
In the Macro, within the OpenReport command, is the report you are trying to open listed in the dropdown? Did you do a repair and compact on the new db?
 
Yes to both: I did compact & repair new db and the report is listed in the dropdown of the macro.

(I may have to leave this till Monday am now.)
 
Created a new macro and basically copied everything that was in the old one and it works. Can't understand why, but it's sorted it which is excellent. Thanks everyone for all your comments and help.
 

Users who are viewing this thread

Back
Top Bottom