Code to determine current db size.

C

CT

Is there a way to determine current or extenal database
size within VB code?

I want to exit out of code before I error out due to
maximum database size.

CT
 
N

Nikos Yannacopoulos

This will give you the size of the current database:

Function db_size()
Set fso = CreateObject("Scripting.FileSystemObject")
Set fo = fso.Getfile(CurrentDb.Name)
db_size = fo.Size
End Function

It can be easily modified for another file:

Function file_size()
vfile = "FullPathAndFileName.ext"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fo = fso.Getfile(vfile)
file_size = fo.Size
End Function

HTH,
Nikos
 
C

CT

Code exactly what I needed. Worked great.
Thank you!

I have code to compact external database.
It renames db and I have to kill old db. Do you know of
any code where it kills/renames without having to specify
any other db names other than identifying the db to
compact?

CT
 
Top