hello dear reader,
many answers I received on my problem and I tried them all. Thankyou !
They all have the same difficulty caused by my initially incorrect
statement that I only wanted to relink a linked file in Access.
To know better what I mean please read (and try):
As you can see, if the user moves his database to a different location
from the one my application is supposed to be, all linked files have to
Under the URL, mentioned above you have a wonderfull solution to do this
from inside Access.
So if a user has MS-Access he can use this relinking routine and instead
of using the adin-manager to reorganize and relink the linked files he
could do this with this routine.
But if he has not, then this routine has to be started in VB and it
should also work. However there are some different codings in VB for
applications then in VB. And the greatest problem is, that the above
routine does not at all take into consideration, that also different
files (tables) then Access tables could be linked.
In my case it is one silly dBase(IV) file (only) and I do not know at
all, how I can get this routine above to work propperly.
So my question is, what have I to alter on that routine to get it going
in VB6 ?
Your help is very urgent, I have a deadline !
Regards Otto Duve
One function I received, which seems to be very interesting also, has
the same problem:
a) it was written for VB for applications and I do not know how to run
it in VB-6 and
b) what is the connection parameter for a dbfile.
The name of the dBase file is simply 'ARTICLE' and it is linked
without any indices. I do the sorting by SQL if necessary.
This is the function:
'/////How shall I alter here ???Quote:
> the following function was designed to run from access, but you can
> modify it to run from VB by changing the set db=currentdb line. it
> creates a new tabledef and sets its .Connect property (DAO):
> Function RelinkTable(strTable As String, strSourceTable _
> As String, strSourceDB As String) As Boolean
> ' Returns True if table is relinked, False
> ' on any error in the relinking process
> Dim db As Database
> Dim tdf As TableDef
> Set db = CurrentDb
'/////The deletion works by using:
'/////Set db =
'///// which I wanted to move to........\placetwo\...
'///// this does not work with the dBase-fileQuote:> On Error Resume Next
> ' Delete the link if it already exists.
> ' If not, ignore error
> db.TableDefs.Delete strTable
> ' Reset Err object to 0
> Err = 0
> On Error GoTo HandleErr
> ' Create new link
> Set tdf = db.CreateTableDef(strTable)
> ' Set the Connect properties to point to
> ' the source database and append the new
> ' link to the tabledefs collection
> ' in the destination db.
> tdf.SourceTableName = strSourceTable
> tdf.Connect = ";DATABASE=" & strSourceDB
'//////Here I get an error permanentlyQuote:> db.TableDefs.Append tdf
> RelinkTable = True
> Exit Function
> Select Case Err
> Case 3433 ' database format not recognized
> MsgBox "Unrecognized database format", , "Can't refresh
> Case 438, 3078 ' object doesn't support method
> MsgBox "Invalid tables. Please try another " _
> & "table database.", , "Can't refresh links"
> Case 3110 ' no read def permissions
> ' This is the error we want to ignore
> Resume Next
> Case Else
> MsgBox Err & ": " & Err.Description, , "Error in
'//////// This was my first request:Quote:> End Select
> RelinkTable = False
> Resume ExitHere
> End Function
the line tdf.connect = ";DATABASE=" & strSourceDBQuote:> >in my application I use an xxx.mdb and in there I have one linked
> >The programm runs OK !
> >When testing on a different machine with different pathnames I have
> >go to my Access-Program, call the linking-assistent and change the
> >This is OK with me, but not with my customer. I could tell him how to
> >debug this situation but this only works, if he has Access.
> >So, assuming he had not , I am looking for a method to path through
> >this address-string to Access.
> >There is a function called RefreshTableLinks in the solutions.mdb in
> >Access but as far as I understand, this is only for an application
> >which is resident within Access. I could not find a way to come from
> >outside Access.
> >Who can help ??
> >Regards Otto
is probably not usable for a dbasefile to be linked.
Thanks in advance.
Frankfurt / Germany