PC Review


Reply
Thread Tools Rate Thread

Change Path of Linked Tables

 
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      12th Apr 2006
Good morning,

I would like to be able to change the path of all the linked tables in the
front-end of my application so that when I deliver it to our secondary site,
it is ready to go. \

I tried the following code that came from another post, but it generates an
error "Compile error: Expected: =" and yet it compiles just fine?

****

Dim db As DAO.database
Dim tdf As DAO.TableDef
Dim strPath As String
strPath = "C:\test\testdb.mdb"

Set db = CurrentDb()
Set tdf = db.TableDefs!linkedtable
tdf.Connect = ";DATABASE=" & strPath
tdf.RefreshLink
Set tdf = Nothing
Set db = Nothing
****

Is it possible to change the path to a structure/dir that does not exists on
the computer I am working on?

Thank you for your help!

Daniel
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      12th Apr 2006
Yes, you can set the connect proprerty to anything. It, of course will raise
an error when it tries to connect to a backend that has an invalid path.

On which line are you getting the error?

"Daniel" wrote:

> Good morning,
>
> I would like to be able to change the path of all the linked tables in the
> front-end of my application so that when I deliver it to our secondary site,
> it is ready to go. \
>
> I tried the following code that came from another post, but it generates an
> error "Compile error: Expected: =" and yet it compiles just fine?
>
> ****
>
> Dim db As DAO.database
> Dim tdf As DAO.TableDef
> Dim strPath As String
> strPath = "C:\test\testdb.mdb"
>
> Set db = CurrentDb()
> Set tdf = db.TableDefs!linkedtable
> tdf.Connect = ";DATABASE=" & strPath
> tdf.RefreshLink
> Set tdf = Nothing
> Set db = Nothing
> ****
>
> Is it possible to change the path to a structure/dir that does not exists on
> the computer I am working on?
>
> Thank you for your help!
>
> Daniel

 
Reply With Quote
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      12th Apr 2006
When it gives me the error message it does not interupt and highlight a
specific line?




"Klatuu" wrote:

> Yes, you can set the connect proprerty to anything. It, of course will raise
> an error when it tries to connect to a backend that has an invalid path.
>
> On which line are you getting the error?
>
> "Daniel" wrote:
>
> > Good morning,
> >
> > I would like to be able to change the path of all the linked tables in the
> > front-end of my application so that when I deliver it to our secondary site,
> > it is ready to go. \
> >
> > I tried the following code that came from another post, but it generates an
> > error "Compile error: Expected: =" and yet it compiles just fine?
> >
> > ****
> >
> > Dim db As DAO.database
> > Dim tdf As DAO.TableDef
> > Dim strPath As String
> > strPath = "C:\test\testdb.mdb"
> >
> > Set db = CurrentDb()
> > Set tdf = db.TableDefs!linkedtable
> > tdf.Connect = ";DATABASE=" & strPath
> > tdf.RefreshLink
> > Set tdf = Nothing
> > Set db = Nothing
> > ****
> >
> > Is it possible to change the path to a structure/dir that does not exists on
> > the computer I am working on?
> >
> > Thank you for your help!
> >
> > Daniel

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      12th Apr 2006


"Daniel" wrote:

> When it gives me the error message it does not interupt and highlight a
> specific line?
>
>
>
>
> "Klatuu" wrote:
>
> > Yes, you can set the connect proprerty to anything. It, of course will raise
> > an error when it tries to connect to a backend that has an invalid path.
> >
> > On which line are you getting the error?
> >
> > "Daniel" wrote:
> >
> > > Good morning,
> > >
> > > I would like to be able to change the path of all the linked tables in the
> > > front-end of my application so that when I deliver it to our secondary site,
> > > it is ready to go. \
> > >
> > > I tried the following code that came from another post, but it generates an
> > > error "Compile error: Expected: =" and yet it compiles just fine?
> > >
> > > ****
> > >
> > > Dim db As DAO.database
> > > Dim tdf As DAO.TableDef
> > > Dim strPath As String
> > > strPath = "C:\test\testdb.mdb"
> > >
> > > Set db = CurrentDb()
> > > Set tdf = db.TableDefs!linkedtable
> > > tdf.Connect = ";DATABASE=" & strPath
> > > tdf.RefreshLink
> > > Set tdf = Nothing
> > > Set db = Nothing
> > > ****
> > >
> > > Is it possible to change the path to a structure/dir that does not exists on
> > > the computer I am working on?
> > >
> > > Thank you for your help!
> > >
> > > Daniel

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      12th Apr 2006
is linkedtable the name of a table or are you trying to use a variable?
The syntax below is correct if linkedtable is a table name, but when I tried
this syntax using it as a variable with a table name it it, I got error 3265
"Item Not Found in this collection." When I use an actual table name, it
worked. Here is a function I know works. It will refresh all the links in
your database:

Private Function ReLink(strNewPath As String) As Boolean
Dim dbs As Database
Dim tdf As TableDef
Dim intCount As Integer
Dim frmCurrentForm As Form

DoCmd.Hourglass True
On Error GoTo ErrLinkUpExit
Me.lblMsg.Visible = True
Me.cmdOK.Enabled = False

Set dbs = CurrentDb

For intCount = 0 To dbs.TableDefs.Count - 1
Set tdf = dbs.TableDefs(intCount)
If tdf.Connect <> "" Then
Me.lblMsg.Caption = "Refreshing " & tdf.NAME
DoEvents
tdf.Connect = ";DATABASE=" & strNewPath
tdf.RefreshLink
End If ' tdf.Connect <> ""
Next intCount

Set dbs = Nothing
Set tdf = Nothing

DoCmd.Hourglass False
Me.lblMsg.Caption = "All Links were refreshed!"
ReLink = True
Me.cmdOK.Enabled = True
Exit Function


"Daniel" wrote:

> When it gives me the error message it does not interupt and highlight a
> specific line?
>
>
>
>
> "Klatuu" wrote:
>
> > Yes, you can set the connect proprerty to anything. It, of course will raise
> > an error when it tries to connect to a backend that has an invalid path.
> >
> > On which line are you getting the error?
> >
> > "Daniel" wrote:
> >
> > > Good morning,
> > >
> > > I would like to be able to change the path of all the linked tables in the
> > > front-end of my application so that when I deliver it to our secondary site,
> > > it is ready to go. \
> > >
> > > I tried the following code that came from another post, but it generates an
> > > error "Compile error: Expected: =" and yet it compiles just fine?
> > >
> > > ****
> > >
> > > Dim db As DAO.database
> > > Dim tdf As DAO.TableDef
> > > Dim strPath As String
> > > strPath = "C:\test\testdb.mdb"
> > >
> > > Set db = CurrentDb()
> > > Set tdf = db.TableDefs!linkedtable
> > > tdf.Connect = ";DATABASE=" & strPath
> > > tdf.RefreshLink
> > > Set tdf = Nothing
> > > Set db = Nothing
> > > ****
> > >
> > > Is it possible to change the path to a structure/dir that does not exists on
> > > the computer I am working on?
> > >
> > > Thank you for your help!
> > >
> > > Daniel

 
Reply With Quote
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      12th Apr 2006
1. you were absolutely right about the table issue. I didn't realize that
about the code.

2. I used your code and as you said an error is raised when trying to link
to a non-existant path. err.number 3044. So how can force the db to accept
this path anyways?

Thank you once again for your help!

Daniel

"Klatuu" wrote:

> is linkedtable the name of a table or are you trying to use a variable?
> The syntax below is correct if linkedtable is a table name, but when I tried
> this syntax using it as a variable with a table name it it, I got error 3265
> "Item Not Found in this collection." When I use an actual table name, it
> worked. Here is a function I know works. It will refresh all the links in
> your database:
>
> Private Function ReLink(strNewPath As String) As Boolean
> Dim dbs As Database
> Dim tdf As TableDef
> Dim intCount As Integer
> Dim frmCurrentForm As Form
>
> DoCmd.Hourglass True
> On Error GoTo ErrLinkUpExit
> Me.lblMsg.Visible = True
> Me.cmdOK.Enabled = False
>
> Set dbs = CurrentDb
>
> For intCount = 0 To dbs.TableDefs.Count - 1
> Set tdf = dbs.TableDefs(intCount)
> If tdf.Connect <> "" Then
> Me.lblMsg.Caption = "Refreshing " & tdf.NAME
> DoEvents
> tdf.Connect = ";DATABASE=" & strNewPath
> tdf.RefreshLink
> End If ' tdf.Connect <> ""
> Next intCount
>
> Set dbs = Nothing
> Set tdf = Nothing
>
> DoCmd.Hourglass False
> Me.lblMsg.Caption = "All Links were refreshed!"
> ReLink = True
> Me.cmdOK.Enabled = True
> Exit Function
>
>
> "Daniel" wrote:
>
> > When it gives me the error message it does not interupt and highlight a
> > specific line?
> >
> >
> >
> >
> > "Klatuu" wrote:
> >
> > > Yes, you can set the connect proprerty to anything. It, of course will raise
> > > an error when it tries to connect to a backend that has an invalid path.
> > >
> > > On which line are you getting the error?
> > >
> > > "Daniel" wrote:
> > >
> > > > Good morning,
> > > >
> > > > I would like to be able to change the path of all the linked tables in the
> > > > front-end of my application so that when I deliver it to our secondary site,
> > > > it is ready to go. \
> > > >
> > > > I tried the following code that came from another post, but it generates an
> > > > error "Compile error: Expected: =" and yet it compiles just fine?
> > > >
> > > > ****
> > > >
> > > > Dim db As DAO.database
> > > > Dim tdf As DAO.TableDef
> > > > Dim strPath As String
> > > > strPath = "C:\test\testdb.mdb"
> > > >
> > > > Set db = CurrentDb()
> > > > Set tdf = db.TableDefs!linkedtable
> > > > tdf.Connect = ";DATABASE=" & strPath
> > > > tdf.RefreshLink
> > > > Set tdf = Nothing
> > > > Set db = Nothing
> > > > ****
> > > >
> > > > Is it possible to change the path to a structure/dir that does not exists on
> > > > the computer I am working on?
> > > >
> > > > Thank you for your help!
> > > >
> > > > Daniel

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting path of linked tables mdb John J. Microsoft Access 1 26th Sep 2008 10:09 PM
Change Path Of Multiple Linked Tables at Once Neil Microsoft Access 6 6th Jun 2008 07:11 PM
Specifying path to linked tables =?Utf-8?B?QmFieSBGYWNlIExlZQ==?= Microsoft Access Database Table Design 6 28th Jun 2005 09:44 AM
HELP!! Still can't change the path on my linked tables =?Utf-8?B?Qm9iIFNjdWxsZW4=?= Microsoft Access 4 2nd Feb 2005 09:20 PM
using linked table manager to update path on linked tables Nydia Microsoft Access 4 19th Aug 2003 11:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 AM.