Is there a way to check link´s for linked tables?

  • Thread starter Thread starter Niklas Östergren
  • Start date Start date
N

Niklas Östergren

Hi!

Is there a way to check if one or several table link´s between a front end
and backend db is broken?

I have a function, copyed from a book I have, which I can use to refresh all
link´s for linked tables between a front end and backen db. But before I do
that I´d like to check if it´s nessesary when my application start´s up. And
only if it is THEN I try to refresh the link´s automaticly. And if that
doesn´t succeed then I let the user to fins where the backend is located.

My Q is:
Is there a way I can find out if one or several of the table link´s is
broken?

TIA!
// Niklas
 
Sorry!

Forget about the Q since I think I can use this code, in the function I
copyed:

If tblLinked.Connect <> "" Then


End If


// Niklas
 
That won't tell you if a link is broken, Niklas, it will only tell you if
the table is a linked table or not. To determine whether a link is broken, I
usually attempt to open a recordset on the linked table, and trap the error
that will occur if the link is broken. An alternative approach would be to
extract the path from the link and then use the Dir() function to determine
whether the path is valid ...

Public Sub TestLink()

Dim strPath As String

strPath = CurrentDb.TableDefs("Categories1").Connect
strPath = Mid$(strPath, InStr(1, strPath, "=") + 1)
If Dir(strPath) <> vbNullString Then
MsgBox "Found it"
Else
MsgBox "Didn't"
End If

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
OK!

Thank´s Brendan!

I´ll take a closer look at it asap. and I´ll get back to you if I can´t get
it to work!

Thank´s for a quick reply!

// Niklas
 
Hi!

Is there a way to check if one or several table link´s between a front end
and backend db is broken?

I have a function, copyed from a book I have, which I can use to refresh all
link´s for linked tables between a front end and backen db. But before I do
that I´d like to check if it´s nessesary when my application start´s up. And
only if it is THEN I try to refresh the link´s automaticly. And if that
doesn´t succeed then I let the user to fins where the backend is located.

My Q is:
Is there a way I can find out if one or several of the table link´s is
broken?

TIA!
// Niklas
either open the linktable and watch for errors
or
use: (simplified only Database= is in the connect string!!!)
dim db as DAO.Database
dim tbl as DAO.tabledef
set db=currentdb
if dir(Mid(tbl.connect(Instr(tbl.connect("DATABASE=")+9)="" then
msgbox "Link Error"
endif
 
Thank´s a lot Brendan!

This method semas to work and I have just implemented more logic to help the
user to refresh the links if they are broken.

Thank´´s a lot for helping out here!

// Niklas
 

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

Similar Threads


Back
Top