Button to Compact Database

D

Dwayne Conyers

I have code to compact the database. I need to add lines to report the size
to the user before and after compacting. Would appreciate any tips on
capturing the file size to a variable.

Thanks.


<!-- CODE APPEARS BELOW //-->

Private Sub cmdCompact_Click()
On Error GoTo Err_cmdCompact_Click

sizenow = CurrentProject
MsgBox sizenow

Dim currpath As String

currpath = CurrentProject.Path
ourmdb = CurrentProject.FullName
ourmde = currpath + "\lessons_learned.mde"

Dim accApp As Access.Application
Set accApp = New Access.Application
accApp.SysCmd 603, ourmdb, ourmde
accApp.SysCmd 602, ourmdb, ourmdb
Set accApp = Nothing
MsgBox "The database has been successfully compacted.", vbInformation +
vbOKOnly, "Operation Complete"

Exit_cmdCompact_Click:
Exit Sub

Err_cmdCompact_Click:
fooBAR

End Sub
 
A

Adrian Jansen

Assuming you have the full pathname of the db, then FileLen(pathname) will
return the length of the file as a Long.


--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 

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