Results 1 to 5 of 5

Thread: Link Address

  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Link Address

    Is there any way to change the address of a Linked table in Access 97 so that it accesses the local directory (whatever that happens to be at the time)? Right now the address includes the entire path starting with C:... I assume that if the address contained only the name of the table with no path that it would default to the directory that the application is running in. (Perhaps a bad assumption?)

    Access doesn't permit any change to the properties of the linked tables, but that is the only place where I find the table's address.

  2. #2
    Lounger
    Join Date
    Apr 2001
    Location
    Stuttgart, Germany
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Link Address

    Your assumtion is indeed bad, Access always stores the complete path - otherwise cannot find its tables. The solution is to write a function which checks the links, asks the user for the new table location if the link is broken, then refreshes the link (=updates the path).
    You can call this function in the AutoExec macro with the ExecuteCode command (or something like this, I have german version), so the links will be checked each time you start the application.

    If you have a Getz/Litwin/etc book around (Access Dev handbook), you can find the code there. Or maybe someone else around here has it, mine is full of german comments.

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Link Address

    Thanks Emila,

    It sounds mighty complicated to me, but I will look into it.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Link Address

    Hi Chuck,

    I found this code in <A target="_blank" HREF=http://www.woodyswatch.com/access/archtemplate.asp?1-03>Woody's Access Watch #1.03</A>. This will return the path of the current database. I've modified it just a little from it's original state. (Please forgive my poor commenting... <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>)<pre>Public Function DBPath() As String
    'I got this function from Woody's Access Watch (#1.03 - <A target="_blank" HREF=http://www.woodyswatch.com>http://www.woodyswatch.com</A>)
    Dim dbs As Database
    Dim strTestChar As String
    Dim strPathAndName As String
    Dim strPath As String
    'Dim strDBName As String
    Dim intPosition As Integer

    Set dbs = CurrentDb
    strTestChar = "-"
    intPosition = 1
    strPathAndName = dbs.Name
    'Debug.Print "Path and name: " & strPathAndName
    strPath = Mid(strPathAndName, 1, InStr(strPathAndName, Chr(46)) - 1)
    Do While strTestChar <> ""
    strTestChar = Left(Right(strPath, intPosition), 1)
    intPosition = intPosition + 1
    Loop

    strPath = Left(strPathAndName, Len(strPathAndName) - intPosition - 2)
    'strDBName = Right(strPathAndName, intPosition + 2)
    DBPath = strPath

    End Function</pre>

    This assumes DAO and not ADO (for Access 2000).
    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Link Address

    Access 97 help had some sample code in it. Look up Connect Property in help and look at the example. That will at least get you started on manipulating the connection. Be warned though, that doing it in Access 2000 with ADO is very different.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •