[AccessD] Connect String for Linked Table

Charlotte Foust charlotte.foust at gmail.com
Fri Nov 20 18:51:12 CST 2015


Yes, I know.  It goes right through the list of tabledefs and never finds
those with broken links.  My original code looked something like that.

Charlotte

Charlotte Foust
(916) 206-4336

On Fri, Nov 20, 2015 at 4:47 PM, David McAfee <davidmcafee at gmail.com> wrote:

> will this work?
>
> With a linked table, the tabledef.Connect contains the connection
> information.
> With a non-linked table, the .Connect property is an empty string
>
> Dim tdf As DAO.TableDef
> With CurrentDb
> For Each tdf In .TableDefs
>         If Len(tdf.Connect) > 0 Then
>             Debug.Print tdf.Name, tdf.Connect
>         End If
>     Next
> End With
>
> On Fri, Nov 20, 2015 at 3:46 PM, Charlotte Foust <
> charlotte.foust at gmail.com>
> wrote:
>
> > Now I'm getting the "item not found" message on
> >
> > Set tdf = CurrentDb.TableDefs(strTableName)
> >
> > Charlotte
> >
> > Charlotte Foust
> > (916) 206-4336
> >
> > On Fri, Nov 20, 2015 at 3:33 PM, Charlotte Foust <
> > charlotte.foust at gmail.com>
> > wrote:
> >
> > > The table isn't getting deleted, that's the crazy thing.  It's still
> > > there, and it still appears in the navigation pane.  The "item not
> found"
> > > was being triggered by the call to the DoesObjectExist function.  I'm
> > about
> > > ready to start googling for exorcists!
> > >
> > > Charlotte
> > >
> > > Charlotte Foust
> > > (916) 206-4336
> > >
> > > On Fri, Nov 20, 2015 at 3:26 PM, Stuart McLachlan <
> > stuart at lexacorp.com.pg>
> > > wrote:
> > >
> > >> I doubt that your problem les with this function.
> > >>
> > >> If it returns False "when called from code", then I'd suspect that
> your
> > >> code is deleting the
> > >> table before this function is called.
> > >>
> > >> What line is highlighted when you get the "item not found" error.
> > >>
> > >> On 20 Nov 2015 at 15:02, Charlotte Foust wrote:
> > >>
> > >> > 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
> > >> > > --
> > >> > > AccessD mailing list
> > >> > > AccessD at databaseadvisors.com
> > >> > > http://databaseadvisors.com/mailman/listinfo/accessd
> > >> > > Website: http://www.databaseadvisors.com
> > >> > >
> > >> > --
> > >> > AccessD mailing list
> > >> > AccessD at databaseadvisors.com
> > >> > http://databaseadvisors.com/mailman/listinfo/accessd
> > >> > Website: http://www.databaseadvisors.com
> > >>
> > >>
> > >>
> > >> --
> > >> AccessD mailing list
> > >> AccessD at databaseadvisors.com
> > >> http://databaseadvisors.com/mailman/listinfo/accessd
> > >> Website: http://www.databaseadvisors.com
> > >>
> > >
> > >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list