Link to home
Start Free TrialLog in
Avatar of Jacques Geday
Jacques GedayFlag for Canada

asked on

VB6 DAO Opendatabase Connect for Excel 2007

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
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jacques Geday

ASKER

No this is ADO !!! I need DAO

gowflow
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.
@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
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.
the above posted, I did look up this page:
http://support.microsoft.com/kb/209805
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
glad I could help!

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