|
-
Apr 20th, 2002, 11:36 AM
#1
Thread Starter
PowerPoster
opening old MDB vs new MDB files
I have an absolutely outstanding sample application that I was given to demonstrate how to use VB to work with Access databases. It works wonderfully, but only on old MDB files, and I want to update it to work with Access 2000 MDB files.
The rub seems to be with this code:
Dim DB As Database
Set DB = OpenDatabase(txtPath, , True, "Access")
the txtPath is correct (it's selected from a common dialog box), but if it points to an old MDB file the open works fine and if it points to a new (Access 2000) MDB file, the open fails and give a message saying "unrecognized database format <filename>" where <filename> is the name of the file.
The person who gave me the file online (but who has declined to give me any help with it - hey, it was nice of him to provide it) suggested that I replace "Access" with "Access 4.0" but doing that changes nothing. In fact if I replace the "Access" with "junk" nothing changes, which seems really weird.
I've looked at everything I can find in the online help, particulary the OpenDatabase method, but can't find anything even mentioning the use of "Access" or "Access 4.0", much less why "junk" would work or why old files word and new files don't work.
Any help you can give will be appreciated. Thanks.
Paul
-
Apr 20th, 2002, 11:29 PM
#2
Frenzied Member
In Projects|References, which Data Object(s) are referenced?
-
Apr 21st, 2002, 05:08 AM
#3
Lively Member
Re: opening old MDB vs new MDB files
[QUOTE]Originally posted by phinds
[B]I have an absolutely outstanding sample application that I was given to demonstrate how to use VB to work with Access databases. It works wonderfully, but only on old MDB files, and I want to update it to work with Access 2000 MDB files.
The rub seems to be with this code:
Dim DB As Database
Set DB = OpenDatabase(txtPath, , True, "Access")
the txtPath is correct (it's selected from a common dialog box), but if it points to an old MDB file the open works fine and if it points to a new (Access 2000) MDB file, the open fails and give a message saying "unrecognized database format <filename>" where <filename> is the name of the file.
What Provider are u using?
and how do you connect to your database
Send me your connection code
Passed without Knowledge, has no Future
MCSE, MCP, SQL,
-
Apr 21st, 2002, 06:33 AM
#4
Thread Starter
PowerPoster
to John McKernan:
1) OLE Automation
2) Microsoft DAO 3.51 Object Library
to Brianchetty: there is no connection string; the OpenDatabase call happens pretty much immediately upon acquisition of the MDB file name from a common dialog box.
-
Apr 21st, 2002, 06:48 AM
#5
Thread Starter
PowerPoster
the whole project ZIPed is 220K --- I haven't emailed it to anyone because I consider attachments even that large to be rude if sent without notice, but I'd be happy to send it if you would be willing to take a look at it.
Thanks for your time.
-
Apr 21st, 2002, 07:44 AM
#6
Thread Starter
PowerPoster
got it
John McKernan's questioning what data objects were referenced led me to play with these and lo and behold, changing
"Microsoft DAO 3.51 Object Library"
to
"Microsoft DAO 3.6 Object Library" did the trick
This did cause some of the rest of the project to behave badly, but that's another issue entirely and now I'll attack that problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|