اشكرك اخي
هل المكان الملون بالاصفر اضع اسم الجدول وهل عند فقد الاتصال ستظهر رسالة؟؟
Private Function TableLinkOkay(strTableName As String) As Boolean
'Function accepts a table name and tests first to determine if linked
'table, then tests link by performing refresh link.
'Error causes TableLinkOkay = False, else TableLinkOkay = True
Dim CurDB As dao.Database
Dim tdf As TableDef
Dim strFieldName As String
On Error GoTo TableLinkOkayError
Set CurDB = DBEngine.Workspaces(0).Databases(0)
Set tdf = CurDB.TableDefs(strTableName)
TableLinkOkay = True
If tdf.Connect <> "" Then
'#BGC updated to be more thorough in checking the link by opening a recordset
'ACS 10/31/2013 Added brackets to support spaces in table and field names
strFieldName = CurDB.OpenRecordset("SELECT TOP 1 [" & tdf.Fields(0).Name & "] FROM [" & tdf.Name & "];", dbOpenSnapshot, dbReadOnly).Fields(0).Name 'Do not test if nonlinked table
End If
TableLinkOkay = True
TableLinkOkayExit:
Exit Function
TableLinkOkayError:
TableLinkOkay = False
GoTo TableLinkOkayExit
End Function