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!

Need help with very syntax.....

Status
Not open for further replies.

ZemogSC

Programmer
Sep 29, 2003
30
US
Hi all,
I don't claim to know much about Access, so be kind. Here's what I've got I've been given some code to convert to work with a newer ODBC driver. THe code runs fine under ODBC2 (the old driver) but no longer works in ODBC3 (new driver). Here's the problem (as far as I can tell):

Dim ws as Workspace ' workspace
Dim msa as Database ' Access db
Dim tdata as Database ' ODBC DB

Set ws = DBEngine(0)
Set msa = ws(0)
Set tdata = ws.Opendatabase("",False,False,CS)

I think this is old syntax, and it has been difficult finding any information on it. My main question is what is DBEngine(0)? My best guess is that it is the workspace object, seeing as DBEngine(0)(0) is the database object. Is there a more acceptable way of writing this (newer more accepted syntax)? If so what would you recommend?

(I say this is old code because there are calls to DB_OPEN_DYNASET, DB_APPENDONLY, etc. But those were easier to fix. :) )

I just fought an uphill battle changing ODBC2 code to ODBC3 code in some C++ processes here, now it looks like I'm going to have to learn the quirks in Access as well.

Thanks in advance, I may have some other questions later.
 
I denote my database references with DAO. - Not sure abour workspace though? hthw,

Dim ws as Workspace ' workspace
Dim msa as DAO.Database ' Access db
Dim tdata as DAO.Database ' ODBC DB

Set ws = CurrentDB
Set msa = ws(0)
Set tdata = ws.Opendatabase("",False,False,CS)


Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
I agree with the above--it can't hurt to add DAO. prefix to every reference to the Database class.

What is the CS identifier listed above? I think that's where your specific problem lies.
 
CS is the connect string, It's connecting fine, but it's not finding the correct table in the ODBC DB.(getting a generic -7722 reserved error)

Thanks for the input, I'll give them a shot and let you know what happens.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top