Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MDB File Version (Jet)

    Is there any way to programatically determine the version of an .mdb file??

    I'm writing a database compacter program that scans our network and compacts databases that it finds. The problem is we're in the middle of a conversion & not all databases on our network are the same version (some Access 97, some Access 2000). I need to be able to determine the file version of the .mdb files so that I can give the correct arguments to the CompactDatabase function...

    Jet OLEDB:Engine Type=" & '// NEED VARIABLE HERE FOR CORRECT VERSION

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MDB File Version (Jet)

    CurrentDb.Version will return the version of the Jet engine that was used to create the database: 3.0 for Access 97 databases and 4.0 for Access 2000 databases.

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB File Version (Jet)

    Hmmm....I'd have to create a connection to the db to determine that tho, would be too resource hungry for what my app is doing. Was hoping for an API of some sort...

    Thanks anyway.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: MDB File Version (Jet)

    To the best of my knowledge, you have to open the database to determine what version of Jet it was created with. Furthermore, both Access 2000 and 2002 return Jet 4 as their version.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB File Version (Jet)

    Managed to do it with a bit of error handling;

    Try and compact with the Jet OLEDB:Engine Type=4 argument (Jet 3.X), if this errors (would for Access 2000) then try again with Jet OLEDB:Engine Type=5...

    Not the most elegant of solutions but it works!

    Thanks for replies...

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MDB File Version (Jet)

    What if the database is in use by another user?
    And you think that compacting the database is *not* resource hungry? <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

  7. #7
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB File Version (Jet)

    If in use by another user, then it will error & write info to log file. Unlikely tho, we're going to be running this overnight as a service (We've told users again & again 'compact your databases', but they never do) We ran something similar to this recently & reclaimed 7GB from one server!

    Well yes it's resource hungry, but I don't want to add to it by creating a connection - checking version & THEN compacting...!! Would take forever to run & want to keep as streamline as possible.

    Thanks

  8. #8
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MDB File Version (Jet)

    I must be missing something. Why can't you use the Compact on Close option?

    Tom

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MDB File Version (Jet)

    Compact on Close was introduced in Access 2000; it doesn't exist for Access 97...

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: MDB File Version (Jet)

    It is very quick to open an instance of the file in code and determine the jet version used to create it. We do this all the time in our apps to see if we need to migrate the data file. If it takes a long time, you're doing something wrong.
    Charlotte

Posting Permissions

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