Determine Database Size Programatically

B

BillyRogers

Is is possible to determine the size of an access database through code?

I would like to have a message displayed on a form that shows the size of
the database that the user is using and show a warning when the size
approaches 2 gigs telling them they need to compact and repair the database
before starting the long running process that they are using the form for.
--
Billy Rogers

Dallas,TX

Currently Using SQL Server 2000, Office 2000 and Office 2003
 
L

limipl

Is is possible to determine the size of an access database through
code?

I would like to have a message displayed on a form that shows the size
of the database that the user is using and show a warning when the
size approaches 2 gigs telling them they need to compact and repair
the database before starting the long running process that they are
using the form for.
Try this:

Sub sizeFile()
Dim fso
Dim myFile

Set fso = CreateObject("Scripting.FileSystemObject")
Set myFile = fso.getfile("path to your file")
MsgBox "Size of file:" & myFile & ":" & vbCrLf & vbCrLf & _
"Octets: " & myFile.Size & " Octets." & vbCrLf & vbCrLf & _
"KiloOctets: " & (myFile.Size / 1024) & " Ko." & vbCrLf & vbCrLf & _
"MegaOctets: " & (myFile.Size / 1024) / 1024 & " Mo."
Set fso = Nothing

End Sub
 

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