• database size (2003)

    Author
    Topic
    #434174

    Is there an easy way in VB to determine the size of your database? I am approaching 1.3 gigs and want a message to pop up when the database is opened stating what size it is. Is this possible?

    Thanks
    Kevin

    Viewing 0 reply threads
    Author
    Replies
    • #1022983

      CreateObject(“Scripting.FileSystemObject”).GetFile(CurrentProject.FullName).Size will return the file size in bytes. Divide by 2^10 to get the size in KB, by 2^20 to get the size in MB, or by 2^30 to get the size in GB.

      • #1022986

        Thanks Hans,

        Sounds like this needs to be in a module with a call to that function from the log on form. Do i need to provide the “Full PathName”, or just the full name with the “.mdb” Extention?

        Thanks
        Kevin

        • #1022988

          CurrentProject.FullName returns the full path and filename of the database.

          You can use it in the On Load event of the startup form of the database, like this:

          Private Sub Form_Load()
          MsgBox "The current size of the database is " & _
          CreateObject("Scripting.FileSystemObject"). _
          GetFile(CurrentProject.FullName).Size / 2^20 & " MB", vbInformation
          End Sub

          If you don’t have a startup form, you can create a function in a standard module:

          Public Function ShowSize()
          MsgBox "The current size of the database is " & _
          CreateObject("Scripting.FileSystemObject"). _
          GetFile(CurrentProject.FullName).Size / 2^20& " MB", vbInformation
          End Function

          Create a macro with a RunCode action with ShowSize() as argument. Name this macro AutoExec. It will be executed automatically when the database is opened.

          • #1022994

            thank you !

          • #1023071

            Hans,

            Just out of curiosity, When there is a Front End / Back End set up and all the tables in the BE are linked to the FE, does this impact any size limitations such as the 2 gig limit on the database? In other words, is the actual database size the combined size of the FE and BE, (because of the linked tables)?

            thanks
            Kevin

            • #1023076

              CurrentProject.FullName gets the front end

              in my case functions GetFile(fngetlinkedpath() & _
              GetLinkedTableDBName(“tsysDBVersionsRemote”) gets the backend

              HTH, John

              Public Function ShowSizeFrontEndMB()
                  MsgBox "The current size of the database is " & _
                      CreateObject("Scripting.FileSystemObject"). _
                      GetFile(CurrentProject.FullName).Size / 2 ^ 20 & " MB", vbInformation
              End Function
              
              Public Function ShowSizeBackEndMB()
                  MsgBox "The current size of the database is " & _
                      CreateObject("Scripting.FileSystemObject"). _
                      GetFile(fngetlinkedpath() & _
                      GetLinkedTableDBName("tsysDBVersionsRemote")).Size / 2 ^ 20 & " MB", vbInformation
              End Function
              
            • #1023103

              Would be interesting to have backend size. Searching the forum for this function fngetlinkedpath() to get the backend path and I was not able to find it. Could you post code?
              Carla

            • #1023166

              Hi Carla

              I think these functions came from the lounge

              TsysDBVersionsRemote is a table that is in all my BE

            • #1023199

              Thank you for the function. I seem to recall seeing them in the lounge, but could not find them with any of the keywords I wued.

              Carla

            • #1023077

              No, since the data are not actually stored in the frontend, they don’t count towards the database size. The linked tables take up only a little bit of space in the frontend database.

    Viewing 0 reply threads
    Reply To: database size (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: