Solved

VB6 DAO Opendatabase Connect for Excel 2007

Posted on 2013-11-13
9
3,441 Views
Last Modified: 2013-11-13
Hello,

I am in trouble !!!!

I have the following code:

Dim toDB as DAO.Database
Set toDB = DBEngine.OpenDatabase("C:\mydb.xls", False, False, "Excel 8.0;")

Open in new window


it works fine my Excel used to be Excel 2003 and my program that is ran in a company for over 5 years works with no headache !!!

We upgraded all over to Excel 2007 and obviously C:\mydb.xls is now C:\mydb.xlsm
I am not able to get the above instruction to work no matter what I did. I change the connect string to "Excel 12.0;" and it is not working I am getting

Error 3170 Could not Find Installable ISAMS

How to get DAO to access Excel 2007 .xlsm

Rgds/gowflow
0
Comment
Question by:gowflow
  • 3
  • 3
  • 3
9 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 39645914
I don't have VB6 here, not sure if this would work:
Data Source=c:\data\myfile.xlsm;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties="Excel 12.0 Macro;HDR=YES";

Open in new window

0
 
LVL 29

Author Comment

by:gowflow
ID: 39645945
No this is ADO !!! I need DAO

gowflow
0
 
LVL 2

Expert Comment

by:corvetteguru
ID: 39645946
I think you need to upgrade a bit... DAO is a dead... it was dying in 2000, and ADO put it to rest for good.

You can reach into Excel 2007 using ADO and "Provider=Microsoft.ACE.OLEDB.12.0", but I suspect DAO is a dead end.

Also, at this stage, you may want to upgrade from VB6 to VB2013. It's a lot more powerful and efficient.

As much as I enjoyed using VB6, I find VB2010 much more satisfying. It does so much more so much easier. And 2013 is even more refined.

Just food for thought... unless there are other restrictions, of course.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 29

Author Comment

by:gowflow
ID: 39646094
@corvetteguru
wow wow not that fast !!!!

tks your Upgrade suggestions but not that easy !!!!

I have a full fledged company that is working on this software not just a tinny 2 line code !!!

I would appreciate a suggestion on DAO as to start not just DAO is dead end. I simply need a confirmation dead solid that DAO WILL NOT OPEN Excel 2007 point blank. then and only then can think of alternatives.

Appreciate all the comments and suggestions that are there.
gowflow
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39646107
sorry, the good old DAO ... I overlooked that, you are not using ADO.

well, I have to confirm that there is no ISAM connector for the .xlsm (or .xlsx) files for DAO.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39646115
the above posted, I did look up this page:
http://support.microsoft.com/kb/209805
0
 
LVL 2

Assisted Solution

by:corvetteguru
corvetteguru earned 250 total points
ID: 39646426
DAO was killed off by ADO... It's that simple, really. Sorry to be the bearer of bad news...

DAO is very limited. ADO is still in use!

I found this:

http://www.excelguru.ca/forums/showthread.php?427-DAO-recorset-with-Excel-2007

but I would still use ADO...
0
 
LVL 29

Author Closing Comment

by:gowflow
ID: 39646527
Tks to both of you angelIII and corvetteguru for your replies and help on this issue.

I found the solution 'thank god' !!!!! it took me some 35 changes and my program is back on its feet running  great with DAO and Excel 2007 and this thanks to this link

http://word.mvps.org/FAQs/InterDev/FillListBoxFromXLDAO.htm

For whoever is having similar problem here is a summary:

If you are needing to retrieve the data from an Excel 2007 spreadsheet, instead of the reference being to the “Microsoft DAO 3.51 (or 3.6) Object Library, it needs to be to the Microsoft Office 12.0 Access database engine Object Library and the code that follows in this article needs to be modified as indicated.

and for sure the whole article talks about mixed data type and the way to go around it. It goes without saying that the syntax is not 100% the same and need some finetuning you need to add  DAO.Database in all your database declarations and DAO.Recordset for all the recordset as well when formerly you could simply declare them as Database and Recordset.

In conclusion for sure ADO is the next generation but when you have a large code 5 modules 25 forms and couple of thousand lines of code it is not just simple to migrate overnite.

Tks to both your help and appreciate all the comments there.
Rgds/gowflow
0
 
LVL 2

Expert Comment

by:corvetteguru
ID: 39646567
glad I could help!

As for migrating, there might be some tools to convert VB6 to the later .NET versions.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question