Check if table links are correct

  • Thread starter Thread starter Rosson
  • Start date Start date
R

Rosson

Hello

I would like to check if a link to a table on an outside
server is working properly before I run a macro. How
would I go about doing this and how would I make the model
crash and/or refresh the links.

Thank you.
 
Hi :

Try this function in VBA. Place in a Module. Call this function with
argument of Table Name and if is returns True is OK else you need to refresh
the link or server is not available.


Public Function CheckLink(strTableName as string) as Boolean

Dim rs as DAO.Recordset

On error resume next
err.number = 0
Set rs = CurrentDb.OpenRecordset(strTableName,dbOpenSnapshot)
if err.number = 0 then
rs.Close
set rs = nothing
CheckLink = True
else
CheckLink = False
end if

End Function

Regards,

Naresh Nichani
Microsoft Access MVP
 
Back
Top