Compile and Repair

Q

Qdxss2b

I have set up a database that is beening used by several other users.

What I would like to do is to write a macro or VBA so that when the program
is being shut down, it will do a compile and repair automaticaly.

Is this possible?

The program is set up so that the basic toolbars are not available for the
users, so anyone login as a user would not be able to access the button on
the toolbar.

Can anybody help?
 
B

biganthony via AccessMonster.com

Hi

Someone gave me this function:

Public Function AutoCompactApplication()

Dim s
Dim strProjectPath As String, strProjectName As String

strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "\" & strProjectName

s = CLng(FileLen(filespec) / 1000000) 'convert size

If s > 20 Then 'edit the 20 (Mb's) to the max size you want to allow
your app to grow.

Application.SetOption ("Auto Compact"), 1 'compact app

Else

Application.SetOption ("Auto Compact"), 0 'no don't compact app

End If

End Function


Call the function when your DB closes down.
 
Q

Qdxss2b via AccessMonster.com

Thank you. I will give that a try.
Hi

Someone gave me this function:

Public Function AutoCompactApplication()

Dim s
Dim strProjectPath As String, strProjectName As String

strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "\" & strProjectName

s = CLng(FileLen(filespec) / 1000000) 'convert size

If s > 20 Then 'edit the 20 (Mb's) to the max size you want to allow
your app to grow.

Application.SetOption ("Auto Compact"), 1 'compact app

Else

Application.SetOption ("Auto Compact"), 0 'no don't compact app

End If

End Function

Call the function when your DB closes down.
I have set up a database that is beening used by several other users.
[quoted text clipped - 8 lines]
Can anybody help?
 

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