"Nando" <(E-Mail Removed)> wrote:
>The EXE is written in Visual Basic 6 using DAO3.6. Below is the code I use,
>but whenever I encounter an Access 2007 (accdb) it fails at the first line
>("3343: Unrecognized database format"). Is there any updates for DAO or any
>other way I can gather some basic database information from the file?
>Thanks!
>
>Set db = DAO.OpenDatabase(MyFilePathname, False, True)
>sver = db.Properties("AccessVersion")
The problem is what if Access 2007 isn't installed on the system
running your exe?
I used DAO as a late binding object starting with DAO version 12.0,
then DAO version 3.6 A2000-A2003, 3.5 - A97, 3.0 - A95 and 2.0 - A2.0.
(I didn't bother with Access 1.0 and 1.1 and that hasn't been a
problem. Now you laugh but I've now had one request for a bug in the
AutoFEUpdater regarding A2.0 and one or two email discussions
regarding A2.0.)
If the open request hit an error 429 then I dropped down a version
until either it worked or it dropped off the end. At which point my
error message stated that they likely need to register DAO.
The key VB 6 code is as follows.
Set objDAO = CreateObject("DAO.DBengine." & strDAOVersion)
Set wrk = objDAO.CreateWorkspace("AutoFEUpdater", "Admin",
vbNullString, dbUseJet)
On Error Resume Next
Set db = wrk.OpenDatabase(strPathAndFileofMDB, True, True)
If Err.Number <> 0 Then
lngErrNumber = Err.Number
strErrorDesc = Err.Description
End If
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -
http://msmvps.com/blogs/access/