setting connection

J

JohnE

I am currently moving from A2003 to A2007 and ran into the "ODBCDirect" error
message. I found that (so far) changing dbUseODBC to dbUseJet corrected the
issue. But, on opening the app another error message occurs and I traced it
back to the the line marked below as the error line. I removed the ODBC but
the error message still occurred.

Here is the whole code function.

Function GetODBCDirectConnection(ByRef wrk As Workspace, ByRef conn As
Connection)
Dim dsn_name As String
Dim database_name As String

Set wrk = DBEngine.CreateWorkspace("NewODBCWorkspace",
"_CorpDBTableLinker", "cdb518zx", dbUseJet)

dsn_name = DLookup("DSN", "_LinkedDataSets", "UseIt = True")
database_name = DLookup("SQLDatabase", "_LinkedDataSets", "UseIt = True")

** error line ** Set conn = wrk.OpenConnection("Connection1", , ,
"ODBC;DATABASE=" & database_name & ";DSN=" & dsn_name)

Exit Function

Err_GetODBCDirectConnection:
Beep
MsgBox Err.Description, vbExclamation, "Get ODBC Direct Connection Error"
Exit Function

End Function

Does anyone see why or what the cause is on that line as I can't see it?
This is an old db that I've inherited and some of this code could be 10 yrs
old.
Let me know what you see (or don't see).
Thanks.
.... John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top