Check if table links are correct

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.
 
N

Naresh Nichani MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top