[AccessD] A97 - SQL Linked Table

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


Never mind my previous post...

I was answering your question in relation to how I used it, not for SQL server.

/decides to read a post properly before replying

Stuart


> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> Hollis,Virginia
> Sent: Tuesday, 21 October, 2003 7:45 PM
> To: 'Access Developers discussion and problem solving'
> Subject: RE: [AccessD] A97 - SQL Linked Table
>
>
> Curious, I have a database with linked SQL Tables. Why would
> you want to do
> this? Why do you refresh the tables?
>
> Virginia
>
> -----Original Message-----
> From: Stuart Sanders [mailto:stuart at pacific.net.hk]
> Sent: Tuesday, October 21, 2003 6:36 AM
> 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