Results 1 to 15 of 15
  1. #1
    Join Date
    Mar 2004
    Posts
    8

    Question Unanswered: Estimate Access Database Size???

    Does anyone know of a simple calculation for estimating the size of an Access 97 database?

  2. #2
    Join Date
    Aug 2002
    Posts
    78

    Re: Estimate Access Database Size???

    Originally posted by sslate
    Does anyone know of a simple calculation for estimating the size of an Access 97 database?
    Not sure of what you are trying to accomplish. If you have the database open, go to file, Database properties . . you will be able to see the current database size.

  3. #3
    Join Date
    Mar 2004
    Posts
    8

    Re: Estimate Access Database Size???

    Originally posted by t_galownia
    Not sure of what you are trying to accomplish. If you have the database open, go to file, Database properties . . you will be able to see the current database size.
    I am trying to estimate the growth of a database that I'm developing based on the number of records to be entered per day. I can't figure out how to estimate each record's size, or the size of the fields within each record.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Keyword here is estimate:
    Code:
    Dim FileLength As Long, FFile As Integer
    FFile = FreeFile
    Open "myDatabaseFileName.mdb" For Input As #FFile  'Open file.
       FileLength = LOF(FFile) 'Get length of file.
    Close #Ffile 'Close file.
    
    MsgBox "File Size Is: " & FileLength & " Bytes."

  5. #5
    Join Date
    Mar 2004
    Posts
    8
    Originally posted by CyberLynx
    Keyword here is estimate:
    Code:
    Dim FileLength As Long, FFile As Integer
    FFile = FreeFile
    Open "myDatabaseFileName.mdb" For Input As #FFile  'Open file.
       FileLength = LOF(FFile) 'Get length of file.
    Close #Ffile 'Close file.
    
    MsgBox "File Size Is: " & FileLength & " Bytes."
    Thanks for your feedback. Where would I put this script? As a macro in the Access database? And is this going to give me record size, or current database file size?

  6. #6
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    well i don't know about "estimate", but you can get the record size from:

    menu: Tools¦Analyze¦Documenter
    select the tables of interest
    set options to...
    Include for table: nothing
    Include for fields: Names, Data Types, and Sizes
    Include for indexes: nothing

    this wont necessarily help you tho! indexes take up space, deleted records take up space (until you compact), and there is a fair amount of "overhead" space as well.

    izy
    currently using SS 2008R2

  7. #7
    Join Date
    Mar 2004
    Posts
    8

    Thumbs up

    I had never used the Documenter before, but it proves to be very helpful! It looks like its counting characters for each field. Would 1 character = 1 byte or kilobyte?

  8. #8
    Join Date
    Nov 2003
    Posts
    1,487
    As the original post is titled:

    Estimate Access Database Size???

    You can use the code I provided in a variety of places but generaly you would want to place it into a Function procedure within the code module of your Form. For example:
    Code:
    Private Function DBSize() as long
       Dim FFile As Integer
       FFile = FreeFile
       Open "myDatabaseFileName.mdb" For Input As #FFile  'Open file.
          DBSize = LOF(FFile) 'Get length of file.
       Close #Ffile 'Close file.
    End Function
    As an example of how to use this function, create a TextBox within your main Form And Name it MyDBSize. In the On Current event of your Form enter the following code:
    Code:
    Me.MyDBSize = DBSize

  9. #9
    Join Date
    Mar 2004
    Posts
    8
    I don't have an ON CURRENT event. I'm running Access 2003. Should I have one?

  10. #10
    Join Date
    Nov 2003
    Posts
    1,487
    Can't say...I've never used 2003. I would think it should but what the heck... do a help file search for On Current and see what comes up.


  11. #11
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    How to show the file size?

    Create a form.
    1) Add a text box to display the MDB file size.
    2) Set the control source of that text box =DBSize()
    3) Place the function that CyberLynx provided in the code behind the form.
        Go to design mode for the form
        Go to the menu item: View | Code
        Copy/Paste CyberLynx's function in.
        Change the database name to match your path and DB name.
    4) Back to the form design, Change the format property to "Standard"
    5) Change the Decimal properties to zero.
    6) View form and Ta da! the text box calls the function and returns the size of your DB.

    NB: to change from bytes to KB (so that it looks like the windows explorer results) divide by 1024. i.e. set your control source to =DBSize()/1024.

    Enjoy.
    Last edited by jpshay; 03-28-04 at 09:40.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  12. #12
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    a reply to a question far back in the thread: one "character" is one byte in my part of the world.

    if you are using kanji (or some other non-roman script), a "character" might be 2 bytes.

    izy
    currently using SS 2008R2

  13. #13
    Join Date
    Nov 2003
    Posts
    1,487
    Good show jpshay.....

  14. #14
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Thanks cyberlynx - but your entry was the most insightful.

        by the way, it was the galloping horse the made me go find a gif for myself.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  15. #15
    Join Date
    Mar 2004
    Posts
    8

    Talking

    Thanks very much to all of you. I used CyberLynx's code, the wonderful (simple) instructions from jpshay, and the explanation of how to measure characters/bytes from izyrider. You provided just what I needed! Have a great day!

Posting Permissions

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