Check presence of linked table

S

Stu

Is there an easy way to check the status of linked tables in Access via VBA
code? Is there a property of the table object that I can check to see if
the link is currently valid or not? Or is there a method somewhere that I
can run to see that the link is valid?

Stu W
 
R

Ron Weiner

If you test for the presence of a Connection in the Table Defs collection
for the table in question you can determine if the table is linked or not..

Set db = CurrentDb
db.TableDefs.Refresh
if Len(db.TableDefs("YourTablename").Connect) > 0 then
' Is a linked table
Else
' Is NOT a linked table
End If
Set db = Nothing

You can also execute a refreshlink method of the TableDefs object
(db.TableDefs("YourTablename").RefreshLink) to test the validity of the
link. If you get an Error then you can be sure the link is bad.

Ron W
 
S

Steven Parsons [MSFT]

Hi Stu -

This is Steven from Microsoft Access Technical Support replying to your
newsgroup post.

Have you seen the following web pages:

ACC2000: How to Relink Back-End Tables with the Common Dialog Control
http://support.microsoft.com/default.aspx?scid=KB;EN-US;209862

MOD2000: How to Refresh Links in a Run-Time Application
http://support.microsoft.com/default.aspx?scid=KB;EN-US;291264

Please let me know if this solves your problem or if you would like further
assistance. I look forward to hearing from you.

Sincerely,
Steven Parsons [MSFT]
Microsoft Access Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! (http://www.microsoft.com/security)
 

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