Detrmine MDB version remotely?

M

Me

Hi all,

I have a little stinging issue,
I have an Access application that has to import hundreds of other
MDB's, some access 97 and some 2000, and merge them into several large
mdb's.
so far so good, but my command:

Set appAccess = GetObject(TargetDBPathNAme, "Access.Application.9")

sometimes fails, of course, when the MDB to be imported is Access 97
type.
How do I determine in advance (before GetObject) what version a closed
(unaccessed) MDB is created with?

the best I have come up with, shamefully, was to use "On error"
detection
like this:
<the beginning of the import loop>

OpenImportConnection = true
Set appAccess = GetObject(TargetDBPathNAme, "Access.Application.9")
OpenImportConnection = false


< the error handling section >


If (Err.Number = 7866 Or InStr(1, Err.Description, "Microsoft Access
can't open the database because it is missing") > 0) And
OpenImportConnection Then

' probably trying to open an Access 97 file as an Access 2000 version,
' so switch importing to version 97

Set appAccess = Nothing
Set appAccess = GetObject(TargetDBPathNAme,
"Access.Application.8")
Resume Next

End If



(I got two types of error mesasges occuring because of this).

is there anything better than this, that doesn't depend on
errorhandling?


Thanks for reading.

hh.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top