
Originally Posted by
Gicu
What do you have in the AutoExec? but like i said it has been running fine for ahwile. when i run the LinkTable manually when i run access holding down shift, it works fine.... i think its something screwy with Access 2016 to be honest, that just started happening.
Cheers,
Macro Runs this
Code:
Public Function LinkTables()
On Error Resume Next
Dim tblDef As DAO.TableDef
Dim Msg, Style, Response
Msg = "Do you want to re-Link the Tables?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Response = MsgBox(Msg, Style)
If Response = vbYes Then
For Each tblDef In CurrentDb.TableDefs
If tblDef.Connect <> "" Then
tblDef.Connect = DLookup("ODBCPath", "tbl_SystemInfo", "SystemInfoID= 1")
Status ("Linking Table " & tblDef.Name)
tblDef.RefreshLink
End If
Status ("")
Next
Else
Exit Function
End If
End Function
Sub Status(pstrStatus As String)
Dim lvarStatus As Variant
If pstrStatus = "" Then
lvarStatus = SysCmd(acSysCmdClearStatus)
Else
lvarStatus = SysCmd(acSysCmdSetStatus, pstrStatus)
End If
End Sub