PC Review


Reply
Thread Tools Rate Thread

Access 2007 file format detection through DAO?

 
 
Nando
Guest
Posts: n/a
 
      28th Oct 2007
Hi all! Not long ago I created a tiny EXE that scans files in a folder and
detects the format of the files for some inventory and data consolidation.
It works fine for mdb files (2000, 2002, 2003). But it cannot detect Access
2007 format.

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")


 
Reply With Quote
 
 
 
 
'69 Camaro
Guest
Posts: n/a
 
      28th Oct 2007
Hi.

> It works fine for mdb files (2000, 2002, 2003). But it cannot detect
> Access 2007 format.
>
> The EXE is written in Visual Basic 6 using DAO3.6.


DAO 3.6 cannot read ACCDB files. OLEDB is required to read the ACE database
file format. If you don't have Office 2007 installed, then you can download
the free Data Connectivity Components for the 2007 Office System Driver.
Please see the following Web page for the download and sample connection
string to connect to the ACCDB files:

http://www.microsoft.com/downloads/d...displaylang=en

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.


 
Reply With Quote
 
Nando
Guest
Posts: n/a
 
      28th Oct 2007
Thanks 69 Camaro, any sample code I can use to implement this connectivity
pack? How do I open database and check the AccessVersion Property?

"'69 Camaro" wrote:
> Hi.
>
>> It works fine for mdb files (2000, 2002, 2003). But it cannot detect
>> Access 2007 format.
>>
>> The EXE is written in Visual Basic 6 using DAO3.6.

>
> DAO 3.6 cannot read ACCDB files. OLEDB is required to read the ACE
> database file format. If you don't have Office 2007 installed, then you
> can download the free Data Connectivity Components for the 2007 Office
> System Driver. Please see the following Web page for the download and
> sample connection string to connect to the ACCDB files:
>
> http://www.microsoft.com/downloads/d...displaylang=en
>
> HTH.
> Gunny
>
> See http://www.QBuilt.com for all your database needs.
> See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
> Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
> http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
> info.
>
>



 
Reply With Quote
 
'69 Camaro
Guest
Posts: n/a
 
      28th Oct 2007
Hi.

> any sample code I can use to implement this connectivity pack?


Sorry. I don't post code I haven't tested, and I don't have a way to test
Access 2007 ACCDB files at the moment. Perhaps someone else can offer some
assistance.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.


 
Reply With Quote
 
Tony Toews [MVP]
Guest
Posts: n/a
 
      29th Oct 2007
"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/
 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      29th Oct 2007
Once you have the OpenDatabase working as Tony indicated, you will be able
to use some of the code from this link to identify the file format etc:
http://allenbrowne.com/ser-53code.html


--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tony Toews [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "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/


 
Reply With Quote
 
Nando
Guest
Posts: n/a
 
      29th Oct 2007
Thanks Tony, I'm currently using something similar. But I don't have a
problem with that. The problem I have is that I cannot do any kind of
analysis with an Access 2007 file. As you I'm using DAO, but it comes up
with "unrecognized database format" error.

I wish I have either a way I can analyze them all (2007 and older) or a way
I can test if the file is 2007. Given the last case I would have to check
for that condition first, and if it is false, then I'll have to check the
file for an older format using my old code I guess.

"Tony Toews [MVP] wrote:
> "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/



 
Reply With Quote
 
Nando
Guest
Posts: n/a
 
      29th Oct 2007
Thanks Allen, everything works fine for anything but Access 2007 files. I'm
using VB6 for my EXE (and DAO36). It seems like DAO36 is fully incompatible.
I need a way to read Access files 2007 and older, or a way to just read 2007
(in that case I'll have to check for this condition first, and if it is
false then I'll have to use the old code to see if is older than 2003). But
there must be a way I can read (even with limited functionality) a file in
Access 2007 format.

"Allen Browne" wrote:
> Once you have the OpenDatabase working as Tony indicated, you will be able
> to use some of the code from this link to identify the file format etc:
> http://allenbrowne.com/ser-53code.html
>
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Tony Toews [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "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/

>



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      29th Oct 2007
Correct: DAO 3.6 is not compatible with the ACCDB file format.

You will need the link that '69 Camaro gave you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Nando" <(E-Mail Removed)> wrote in message
news:G4bVi.292916$(E-Mail Removed)...
> Thanks Allen, everything works fine for anything but Access 2007 files.
> I'm using VB6 for my EXE (and DAO36). It seems like DAO36 is fully
> incompatible. I need a way to read Access files 2007 and older, or a way
> to just read 2007 (in that case I'll have to check for this condition
> first, and if it is false then I'll have to use the old code to see if is
> older than 2003). But there must be a way I can read (even with limited
> functionality) a file in Access 2007 format.
>
> "Allen Browne" wrote:
>> Once you have the OpenDatabase working as Tony indicated, you will be
>> able to use some of the code from this link to identify the file format
>> etc:
>> http://allenbrowne.com/ser-53code.html
>>
>>
>> "Tony Toews [MVP]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> "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/


 
Reply With Quote
 
Nando
Guest
Posts: n/a
 
      29th Oct 2007
"Allen Browne" wrote:
> Correct: DAO 3.6 is not compatible with the ACCDB file format.
>
> You will need the link that '69 Camaro gave you.


Yes, but that's what I'm saying. Even after I downloaded and installed it,
my code still doesn't work.

> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Nando" <(E-Mail Removed)> wrote in message
> news:G4bVi.292916$(E-Mail Removed)...
>> Thanks Allen, everything works fine for anything but Access 2007 files.
>> I'm using VB6 for my EXE (and DAO36). It seems like DAO36 is fully
>> incompatible. I need a way to read Access files 2007 and older, or a way
>> to just read 2007 (in that case I'll have to check for this condition
>> first, and if it is false then I'll have to use the old code to see if is
>> older than 2003). But there must be a way I can read (even with limited
>> functionality) a file in Access 2007 format.
>>
>> "Allen Browne" wrote:
>>> Once you have the OpenDatabase working as Tony indicated, you will be
>>> able to use some of the code from this link to identify the file format
>>> etc:
>>> http://allenbrowne.com/ser-53code.html
>>>
>>>
>>> "Tony Toews [MVP]" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> "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/

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I am using access 2007 but i can not open a .DBF format file. Brian Microsoft Access 4 17th Mar 2009 02:13 PM
Access File Format Compatibilities (2000- 2007) c8tz Microsoft Access 1 3rd Nov 2008 02:33 AM
Convert to Access 2007 file format? LauraB Microsoft Access 1 8th Jun 2008 02:12 PM
MDB (Access 2002-2003) file format in Access 2007 samah Microsoft Access 17 15th Apr 2008 07:32 AM
Access 2007 File Format =?Utf-8?B?S2F0aHk=?= Microsoft Access Getting Started 1 30th Sep 2007 06:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:51 PM.