Hi Guys,
I'm also have the same problem as John posted earlier. The only thin
different here is that I'm using a DSN instead of a file. My DSN, name
'MAS', was connected to the test server. I want to refresh the links s
that the linked tables now points to the production server (I modif
the DSN configuration of 'MAS' to point it to production server an
then run the code with the following .Connect string)
..Connect = "ODBC;Database=MonitorDB;DSN=MAS;Integrated Security=True"
PS : Before running the above code, I'm deleting the old linked table
and recreating using the above connect statement and RefreshLink code.
The problem is that after running the code, the data in the table stil
shows the data for TESTSERVER. If i close my Access application an
reopen again, the table shows the data for the new Server.
Please help
Sajid
I just did some quick tests and you should be able to change th
Connect
String of the Linked Table.
Quick & dirty code from A2K2 Immediate windows (make sure you ad
DAO
Library to the References):
' Existing csv file in A2K2Sample_Test
?DBEngine.WorkSpaces(0)(0).TableDefs("Categories").Connect
Text;DSN=Categories Link Specification;FMT=Delimited;HDR=NO;
IMEX=2;CharacterSet=437;DATABASE=D:\AccessTests\A2K2Sample_Test
' Link to a different csv file same name in A2K2_MyTest
DBEngine.WorkSpaces(0)(0).TableDefs("Categories").Connect = _
"Text;DSN=Categories Link Specification;FMT=Delimited;HDR=NO;
IMEX=2;CharacterSet=437;DATABASE=D:\AccessTests\A2K2_MyTest"
' Check linking
?DBEngine.WorkSpaces(0)(0).TableDefs("Categories").Connect
Text;DSN=Categories Link Specification;FMT=Delimited;HDR=NO;
IMEX=2;CharacterSet=437;DATABASE=D:\AccessTests\A2K2_MyTest
' Refresh link so that Access shows changed Linked Table
' (since we use DAO code and Access still has the old link)
DBEngine.WorkSpaces(0)(0).TableDefs("Categories").RefreshLink
After this, I opened the Linked Table and clearly Access is showin
the data
in the A2K2_MyTest dir.
-
sajid_mansoor