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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating ODBC Link

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
US
Hi all,
I'm using the following code to link odbc tables:

Set TD = db.CreateTableDef(strTname, dbAttachSavePWD, strTname, strTConn)
db.TableDefs.Append TD

Where strTname is a valid odbc table name and strTConn is a valid connection string. This code works fine if I first manually link any other random odbc table (with the same dsn). However, if I open the db and just try to run this without first manually linking some random table, I get the 3151 odbc connection fail error.

I have the full ODBC API in this db, and I can make connections in code just fine and do all the other api-level odbc calls, but it seems that Access has some "private" odbc connection that it uses when connecting 'manually' (via the link wizard), and this seems to be the connection that Access want's when linking odbc tables, whether via the wizard or in the above code.

How do I establish this 'private' connectio--or whatever it needs--automatically?
Thanks,
--jsteph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top