• detect access db size

    Author
    Topic
    #463616

    Actually, two questions: i want to create a form load() event that detects the size of the current db and displays a button for the user to click so they can compact the db. these guys grow quickly.

    the other question is, what was that utility that searches your code and forms to find unused code? i am aiming to finalize this project and perhaps compile it to MDE to protect the code base. i’m sure there’s some unused object sitting around so i wanted to tighten things up a bit.

    TIA!

    Viewing 3 reply threads
    Author
    Replies
    • #1184130

      The size of the active database in bytes is FileLen(CurrentDb.Name)
      You can divide this by 1024 to get kilobytes or by (1024 * 1024) to get megabytes.

    • #1184132

      Note that if you are using a front-end, back-end design (and if you aren’t you should be), then you would need to look at the size of the linked database, not the current database. One trick we sometimes use with front-ends where we really want to lock it down is to make it read-only – that presumes of course that you aren’t making temporary tables and such in the front-end database, which we normally don’t do.

    • #1184141

      To compact the current database: see General – Compact the Current Database from Code.

      To compact another database: DAO has a CompactDatabase method, but you MUST specify a different name for the target database. If you want to emulate the interactive behavior, you must:

        [*]Compact the database to a new database.[*]Verify that the new database has really been created.[*]Delete the original database.[*]Rename the new database to the name of the old one.

      Keep in mind that if you want to compact the backend from a frontend, all connections to the backend must have been closed, otherwise the backend will be “in use”.

      The utility that you mean might be Total Access Analyzer (it’s pricy!)

    • #1184145

      I used the method referred to for compacting the current db – works fine! i had the code from a previous project, just forgot I had it…

      i am not implementing a backend for this project as the whole point is to allow people to take a copy off-line for work in the field. the real backend is SQL Server, FWIW.

      I don’t want to spend any money to clean up the db so guess i’ll do that by hand… painful perhaps, but i know who to blame…

    Viewing 3 reply threads
    Reply To: detect access db size

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

    Your information: