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
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