Results 1 to 6 of 6

Thread: Database Size

  1. #1
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267

    Unanswered: Database Size

    Hi All--

    I'm looking for some code that will tell me the current size (mb, gb, etc.) of the database that the code is running from.

    Thanks.

    C

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I suppose you could shell out to the vbscript file system object
    knowing the directory the application resides you shell out and could pipe the DIR command to a file then read that file within the access app

    to pipe the output of a command its
    dir \path\to\file\file.ext > filesize.txt

    if you do go down the DIR route playign around with the DIR parameters will simply the output. In a DOS window use dir /? to show the possible parameters
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Create a reference to the Microsoft Scripting Runtime library (Tools --> References...) and use this code:
    Code:
    Function GetCurrentDbSize() As Long
    
        Dim fso As FileSystemObject
        Dim fsf As File
        
        Set fso = New FileSystemObject
        Set fsf = fso.GetFile(CurrentDb.Name)
        GetCurrentDbSize = fsf.Size
        Set fsf = Nothing
        Set fso = Nothing
        
    End Function
    Have a nice day!

  4. #4
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Thanks for the replies guys.

    C

  5. #5
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Another possibility is:

    FileLen(CurrentProject.FullName)

  6. #6
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Thanks just what I was looking for. Short and sweet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •