J
JamesP via AccessMonster.com
Hi,
I am having a problem with the following code in Access 2007 ACCDB file with
relinking tables. Error is Run-time error -2147467259 (80004005) Could not
find field. I get to the replace part where it fails. The same code works in
MDB file ok. References are ok and code is as follows:
Dim catDB As New ADOX.Catalog
Dim tblList As New ADOX.Table
DoCmd.SetWarnings False
catDB.ActiveConnection = CurrentProject.Connection
For Each tblList In catDB.Tables
If tblList.Type = "PASS-THROUGH" Then
If Me.DatabaseChooseField = "Development" Then
If InStr(tblList.Properties("Jet OLEDB:Link Provider String"),
"DATABASE=Production") > 0 Then
tblList.Properties("Jet OLEDB:Link Provider String") = Replace
(tblList.Properties("Jet OLEDB:Link Provider String"), "DATABASE=Production",
"DATABASE=Development")
End If
End If
If Me.DatabaseChooseField = "Production" Then
If InStr(tblList.Properties("Jet OLEDB:Link Provider String"),
"DATABASE=Development") > 0 Then
tblList.Properties("Jet OLEDB:Link Provider String") = Replace
(tblList.Properties("Jet OLEDB:Link Provider String"), "DATABASE=Development",
"DATABASE=Production")
End If
End If
End If
Next
catDB.Tables.Refresh
Set catDB = Nothing
Any help appreciated
Thanks,
James
I am having a problem with the following code in Access 2007 ACCDB file with
relinking tables. Error is Run-time error -2147467259 (80004005) Could not
find field. I get to the replace part where it fails. The same code works in
MDB file ok. References are ok and code is as follows:
Dim catDB As New ADOX.Catalog
Dim tblList As New ADOX.Table
DoCmd.SetWarnings False
catDB.ActiveConnection = CurrentProject.Connection
For Each tblList In catDB.Tables
If tblList.Type = "PASS-THROUGH" Then
If Me.DatabaseChooseField = "Development" Then
If InStr(tblList.Properties("Jet OLEDB:Link Provider String"),
"DATABASE=Production") > 0 Then
tblList.Properties("Jet OLEDB:Link Provider String") = Replace
(tblList.Properties("Jet OLEDB:Link Provider String"), "DATABASE=Production",
"DATABASE=Development")
End If
End If
If Me.DatabaseChooseField = "Production" Then
If InStr(tblList.Properties("Jet OLEDB:Link Provider String"),
"DATABASE=Development") > 0 Then
tblList.Properties("Jet OLEDB:Link Provider String") = Replace
(tblList.Properties("Jet OLEDB:Link Provider String"), "DATABASE=Development",
"DATABASE=Production")
End If
End If
End If
Next
catDB.Tables.Refresh
Set catDB = Nothing
Any help appreciated
Thanks,
James