G
Guest
Doug Steele gave me the following bit of code to relink Access ODBC tables
programmatically. It works great.
For Each tdfCurr In dbCurr.TableDefs
If tdfCurr.Connect Like "*adage*" Then
ReDim Preserve typExistingData(0 To intToChange)
typExistingData(intToChange).TableName = tdfCurr.name
typExistingData(intToChange).SourceTableName = tdfCurr.SourceTableName
intToChange = intToChange + 1
End If
Next tdfCurr
If intToChange > 0 Then
For intLoop = 0 To (intToChange - 1)
dbCurr.TableDefs.Delete typExistingData(intLoop).TableName
Set tdfCurr = dbCurr.CreateTableDef(typExistingData(intLoop).TableName)
tdfCurr.Connect = strConnectNew
tdfCurr.SourceTableName = typExistingData(intLoop).SourceTableName
dbCurr.TableDefs.Append tdfCurr
Next intLoop
End If
The only issue I have now is that there are 400+ tables and the Driver stops
at each one to request a password and sign on. Is there a way to feed this
information for the linking process only. I believe the request for this
information is happening at the following statement:
dbCurr.TableDefs.Append tdfCurr
Thanks for your help.
programmatically. It works great.
For Each tdfCurr In dbCurr.TableDefs
If tdfCurr.Connect Like "*adage*" Then
ReDim Preserve typExistingData(0 To intToChange)
typExistingData(intToChange).TableName = tdfCurr.name
typExistingData(intToChange).SourceTableName = tdfCurr.SourceTableName
intToChange = intToChange + 1
End If
Next tdfCurr
If intToChange > 0 Then
For intLoop = 0 To (intToChange - 1)
dbCurr.TableDefs.Delete typExistingData(intLoop).TableName
Set tdfCurr = dbCurr.CreateTableDef(typExistingData(intLoop).TableName)
tdfCurr.Connect = strConnectNew
tdfCurr.SourceTableName = typExistingData(intLoop).SourceTableName
dbCurr.TableDefs.Append tdfCurr
Next intLoop
End If
The only issue I have now is that there are 400+ tables and the Driver stops
at each one to request a password and sign on. Is there a way to feed this
information for the linking process only. I believe the request for this
information is happening at the following statement:
dbCurr.TableDefs.Append tdfCurr
Thanks for your help.