Can you compact on close in access 2000 runtime?

Matrix_zero

Registered User.
Local time
Today, 00:22
Joined
Jan 26, 2005
Messages
64
Can you compact on close in an access 2000 runtime enviorment?

Also, if i select the option to compact on close will it work on every computer i copy this database to? Or is it a property of that computer?
 
Yes, and the option is specific to the mdb file, not to all db's on a PC.

Searching the forum is a great way to discover and learn the answers to your Access programming questions.

I run this function to only compact the db on close if it exceeds my preset amount when the db is being closed.

Code:
'Used with setting the status bar message
Public vStatusBar As Variant

Public Function CompactOnClose()
On Error GoTo Err_CompactOnClose

    If FileLen(CurrentDb.Name) > 5000000 And CurrentUser <> "programmer" Then '5 megabytes
        Application.SetOption ("Auto Compact"), 1
        Application.SetOption "Show Status Bar", True
        vStatusBar = SysCmd(acSysCmdSetStatus, "The application must be compacted, please do not interfere with the Compacting process!")
    Else
        Application.SetOption ("Auto Compact"), 0
    End If

Exit_CompactOnClose:
    Exit Function

Err_CompactOnClose:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_CompactOnClose

End Function
 

Users who are viewing this thread

Back
Top Bottom