[AccessD] Connect String for Linked Table

Gustav Brock gustav at cactus.dk
Fri Nov 20 17:21:56 CST 2015


Hi Charlotte

Oh, I thought you meant some code for relinking the tables.

I'm not sure I understand how you use this function? If the backend is moved, the linked table objects in the frontend don't vanish. 
So what may cause your linked table objects to be deleted?

/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