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
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