Public Function CheckLinks() As Boolean
On Error GoTo CheckLinksErr
Dim tdf As TableDef
Dim strNewMDB As String
Dim fd As FileDialog
For Each tdf In CurrentDb.TableDefs
If UCase(Left(tdf.Name, 6)) <> "CROSGAD" Then
If Len(tdf.Connect) > 0 And tdf.Fields.Count = 0 Then
If Len(strNewMDB) = 0 Then
MsgBox "لا يمكن الاتصال بقاعدة البيانات ، سيتم غلق البرنامج"
DoCmd.Quit
End If
tdf.RefreshLink
End If
End If
Next tdf
CheckLinks = True
CheckLinksDone:
Exit Function
CheckLinksErr:
MsgBox "Error #" & err.Number & ": " & err.Description, vbCritical
Resume CheckLinksDone
End Function