![]() ![]() Just remove it if that's not what you need. Note also that the parameter dbAttachSavePWD passed during creation of the ODBC table will save the ODBC password (if any) in Access. Please make sure you test this and maybe add some code to better handle errors as necessary. ![]() This will completely re-create the ODBC linked tables: the old ones will be renamed, then new tables using the given DSN will be created before deleting the old linked version. Public Sub RefreshODBCLinks(newConnectionString As String)ĭebug.Print "Refreshed ODBC table " & tb.Name "APP=2007 Microsoft Office system DATABASE=OrderSystem "Īlso, have a look at the Access help for the TableDef.RefreshLink method.Ĭlassic way of relinking but Access may keep connection information in memory if the tables have been used before RefreshODBCLinks is called. "SERVER=SQLSERVER UID=Administrator " & _ Just copy the code in a new or existing VBA module and, where you want to refresh the links, call it with the proper DSN for the new ODBC connection: RefreshODBCLinks "ODBC DRIVER=SQL Server Native Client 10.0 " & _" You can use the code below to refresh all ODBC tables in your Access project to a given DSN. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |