July said:
I have a database that needs to be updated with new info
daily, however the user needs to have access to the linked
DB2 tables. How do I check the link so I can end the
update process if they don't have access?
Thanks in advance,
Laura
I'm not sure what you mean by "having access" to the linked tables. Are
you concerned that the tables may not be linked, or that the link is
broken? Or is it that the DB2 database may be on a server that is not
accessible at the moment?
Maybe the simplest thing would be to use DLookup to try to read a field
value from one of the linked tables, and trap the error that will occur
if it can't do it. For example,
Dim varX As Variant
On Error GoTo Err_Inaccessible
varX = DLookup("SomeField", "DB2Table")
On Error GoTo Err_NormalHandler
' ...
Exit_Point:
Exit Sub
Err_Inaccessible:
MsgBox "Can't access the DB2 table!"
Resume Exit_Point
Err_NormalHandler:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Point