[AccessD] Connect String for Linked Table

Gustav Brock gustav at cactus.dk
Sat Nov 21 03:41:16 CST 2015


Hi Charlotte

By second thought, I don't think you can check for a broken link other than trying to open the table and catch an error.

A TableDef with a link doesn't go except if you delete it (why should you?). Or it might never has been there - it's a new table required by a new version of the application - and you would know that and have code that creates this TableDef.

I just check one essential small table linked from the backend. If opening it fails, I relink all tables of that backend.

/gustav

________________________________________
Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af Charlotte Foust <charlotte.foust at gmail.com>
Sendt: 21. november 2015 00:02
Til: Access Developers discussion and problem solving
Emne: Re: [AccessD] Connect String for Linked Table

Public Function DoesObjectExist(ByVal strObjName As String) As Boolean
    On Error Resume Next
    Dim intCnt As Integer

    intCnt = DCount("[Name]", "MSysObjects", "[Name] = '" & strObjName &
"'")
    DoesObjectExist = (intCnt > 0)
End Function

this *usually* returns true for a table with a broken link. Except,
sometimes it doesn't.  It does when I call it from the immediate window,
but when it's called from code, it may return a False.  If my hair weren't
already nearly white, it would be with this.

I'm also sometimes getting "item not found in this collection" when I try
to call the above routine from code.

Charlotte


Charlotte Foust
(916) 206-4336

On Fri, Nov 20, 2015 at 2:57 PM, Gustav Brock <gustav at cactus.dk> wrote:

> Hi Charlotte
>
> And your code is?
>
> /gustav
>
> ________________________________________
> Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af Charlotte
> Foust <charlotte.foust at gmail.com>
> Sendt: 20. november 2015 23:15
> Til: Access Developers discussion and problem solving
> Emne: [AccessD] Connect String for Linked Table
>
> I'm working on a db built in 2010 on Windows 7 but I'm using 2013 on
> Windows 10.  I have code that worked just fine last year but is breaking
> this year because suddenly, if the back end file is moved or renamed, the
> code to set a tabledef object to the linked table in question can't find
> the linked table.  Obviously, the table still exists because the linked
> table manager can see it, so it's still in the system tables, but the code
> breaks.
>
> Any ideas?
>
> Charlotte Foust
> (916) 206-4336



More information about the AccessD mailing list