Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using opendatabase in excel 2007

Status
Not open for further replies.

ck1999

Technical User
Dec 2, 2004
784
US
I am trying to using the following to open a database from excel:

Dim overwrite As Boolean
Dim newdb As dao.Database, pro As Recordset, ing As Recordset
DbName = "\\server\network\enviroserve\price_list\Cost.inv.accdb"
Set newdb = OpenDatabase(DbName, False, False, ";pwd=lockout")

However, I am getting an error unrecognized format.

However this error is only appearing on 2 of 3 computers.

Anyone have any ideas?


ck1999
 



Hi,

Does the offending machine have a reference set, in the VB Editor, to the DAO Object Library?

Skip,

[glasses] [red][/red]
[tongue]
 
There is a reference to Microsoft DAO 3.6 object library.

Also by the way the database was upconverted to a 2007 access database.

ck1999
 
Seems that the 2 computers exhibiting the error haven't offfice2007 installed ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
All three computers have office 07 installed. That is what is so odd. I can open the cost.inv.accdb from each computer and there is no problem with the database. But for some reason with the above code does not work.


ck1999
 
I have made a new database in access 07 and imported everyting in the old database into it to make sure the file was not corrupt or anything.
Still did not recognize the format

But, I saved the access db as a 2002-2003 access file and then tried to use the code and it would recognize the database and run the code.

any ideas?

ck1999
 
Same version of DAO on all computers ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I had this error on two different files. The same files are shared by all three computers. 1 file was a word file and the other an excel file.

With the word file I noticed the reference was for DAO 3.5 so i changed it to 3.6 and it is now working on all three machines. But the database is a 2002-2003 version.

Now I have an excel file that is trying to open a 2007 access database. I have tried using the same code and get an error. The reference on this file is dao 3.6.

ck1999
 
I have decided for at least the time being to save the database in 2002-2003 format and use it this way. I do not know if the opendatabase function is different now in office 2007 when accessing a 2007 database or not. Thank you both for your time and insight.

Ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top