[AccessD] A97 - SQL Linked Table

Stuart Sanders stuart at pacific.net.hk
Tue Oct 21 07:07:21 CDT 2003


Btw some modification is probably required for connecting to SQL server.  You'd
have a better chance of knowing that than me.

Use debug.print on an existing tabledef connection

It should help get you there though.

Stuart


> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> Griffiths, Richard
> Sent: Tuesday, 21 October, 2003 7:58 PM
> To: 'Access Developers discussion and problem solving'
> Subject: RE: [AccessD] A97 - SQL Linked Table
>
>
> thanks
>
> > -----Original Message-----
> > From:	Stuart Sanders [SMTP:stuart at pacific.net.hk]
> > Sent:	21 October 2003 12:36
> > To:	'Access Developers discussion and problem solving'
> > Subject:	RE: [AccessD] A97 - SQL Linked Table
> >
> > I've trimmed this a bit. Removed error handling etc.
> >
> >
> > Public Function CreateAttachedTable(rstrSourceDbs As String, _
> >     rstrDestDbs As String, _
> >     rstrTable As String, _
> >     Optional rstrNewTable As String = vbNullString _
> > ) As Boolean
> > ' Purpose:      creates a new table attachment in the
> specified database
> > ' Parameters:   rstrSourceDbs - path and name of the
> database containing
> > the
> > table to attach to
> > '               rstrDestDbs - path and name of database to
> create the
> > attachment
> > in,
> > '                   or empty string for the current database
> > '               rstrTable - name of the table in
> rstrSourceDbs to attach
> > '               rstrNewTable - new name of table in
> destination database;
> > _
> >                     if empty string, do not change the name
> > ' Returns:      true - successful; false - otherwise
> >
> >     Dim dbs As Database
> >     Dim tdf As TableDef
> >
> >     ' get a handle to the destination database
> >     If rstrDestDbs = vbNullString Then
> >         Set dbs = CurrentDb()
> >     Else
> >         Set dbs = DBEngine.Workspaces(0).OpenDatabase(rstrDestDbs)
> >     End If
> >     ' create a new table object
> >     If Len(Trim(rstrNewTable)) > 0 Then
> >         ' use new table name
> >         Set tdf = dbs.CreateTableDef(rstrNewTable)
> >     Else
> >         ' use original table name
> >         Set tdf = dbs.CreateTableDef(rstrTable)
> >     End If
> >     ' set the appropriate properties to make it an attached table
> >     tdf.Connect = ";DATABASE=" & rstrSourceDbs
> >     tdf.SourceTableName = rstrTable
> >     ' save the new table
> >     dbs.TableDefs.Append tdf
> > End Function
> >
> >
> > > -----Original Message-----
> > > From: accessd-bounces at databaseadvisors.com
> > > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> > > Griffiths, Richard
> > > Sent: Tuesday, 21 October, 2003 7:13 PM
> > > To: 'AccessD at databaseadvisors.com'
> > > Subject: [AccessD] A97 - SQL Linked Table
> > >
> > >
> > > Hi Group
> > >
> > > I am having a brain blockage today - I wish to remove a
> > > linked table at
> > > close of system and re-attach at start. I have code for
> > > refreshing the link
> > > but not create new linked table/delete link. Can anyone help.
> > > (I am linking
> > > to BE SQL db)
> > >
> > > Many thanks
> > >
> > > Richard
> > >
> > > _______________________________________________
> > > 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