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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compact Code from FAQ brings Library Reference Error

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
I found this code in the FAQ'S and thought I would give it a try. When I get to the line that sets the fs = CreateObject I get a Microsoft Access error telling me "Automation Error Library Not Registered" The FAQ states this code works off Access's own Compact on Close feature yet that works fine on this database. I found no missing or broken references. Can anybody tell me what library I need to register.
Thanks.

Dim fs, f, s, filespec
Dim strProjectPath As String, strProjectName As String
strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "\" & strProjectName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
'convert size of app from bytes to Mb’s
s = CLng(f.Size / 1000000)
'edit the 20 (Mb’s) to the max size you want to allow your app to grow.
If s > 25 Then
Application.SetOption ("Auto Compact"), 1 'compact app
Else
Application.SetOption ("Auto Compact"), 0 'no don’t compact app
End If
 
Probably the Microsoft Scripting Runtime library

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
That did it thought oddly enough it was registered with no indications it was missing. I unregistered then re-registered it and now it works.

Is this common?

Thanks again.
 
I've never seen that particular problem, but nothing that happens in a Microsoft application surprises me anymore (especially if you cannot duplicate the problem); remember, "It's not a bug, it's a feature...".

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top