Linked dbaseIV-file in ACCESS to be relinked by VB
My problem is , that I have to relink a dBase (IV) file into ACCESS but
That dBase file is a fact and I can't echchange or import it. It is a
is on a users computer already and is the base of a shopping basket for
Internet. It is not my file, it is part of a third party program.
I have written a warehousing program which takes this dBase file, which
automatically linked within my Access.mdb after installation, if it is
in a certain
location and if it has the specific name 'ARTICLE.dbf'. (It is not
with my program as the user already has it !!)
The name is guaranteed, because the user cannot alter it. The location
is on his own. This file has only about 7 or 10 fields which is not
make a warehousing program, so I made a second additional file and
two in my program.
As you assume I have linked this 'Artikel.dbf' as external data into my
By doing that, I automatically have set a certain pathname on my
in some or many cases will not be identical with the one the user has
That is the reason I have to relink this file from the new location.
done by the user, because he knows where he put it. I know that there is
to do this within ACCESS, but this will not help, if the user doesn't
Therefore I have to do this for him in my program, where he only names
the correct path.
That is all.
If you look further down to that function I received from a helping
hand, there I wrote some
comments with '//// .... and you can see the spots, where I have to do
relinking and exactly there I do not know the dBase(IV) - command line.
Perhaps you can find the answer.
Thanks in advance.
Due to unknown reasons that 'helping hand' is no longer addressable per
to........\placetwo\...for test purposeQuote:> > This is the function:
> > > the following function was designed to run from access, but you
> > > 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
> > '/////How shall I alter here ???
> > '/////The deletion works by using:
> > '/////Set db = _
> > OpenDatabase("c:\linktest\placeone\mymdb.mdb")
> > '///// which I wanted to move
> > > On Error Resume Next
> > > ' Delete the link if it already exists.
> > > ' If not, ignore error
> > > db.TableDefs.Delete strTable
> > > db.TableDefs.Refresh
> > > ' 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
> > '///// this does not work with the dBase-file
> > '///// the line tdf.connect = ";DATABASE=" &
> > '///// is probably not usable for a dbasefile to
> > > db.TableDefs.Append tdf
> > > db.TableDefs.Refresh
> > > RelinkTable = True
> > > ExitHere:
> > > Exit Function
> > > HandleErr:
> > > Select Case Err
> > > Case 3433 ' database format not recognized
> > > MsgBox "Unrecognized database format", , "Can't
> > > links"
> > > 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
> > > advRetLinkConnect"
> > '//////Here I get an error permanently
> > > End Select
> > > RelinkTable = False
> > > Resume ExitHere
> > > End Function
There is also another try for solution :
If you read :
Quote:> > http://support.microsoft.com/support/kb/articles/q181/0/76.asp
> > As you can see, if the user moves his database to a different
> > from the one my application is supposed to be, all linked files have
> > be relinked.
> > Under the URL, mentioned above you have a wonderfull solution to do
> > from inside Access.
> > So if a user has MS-Access he can use this relinking routine and
> > of using the addin-manager to reorganize and relink the linked files
> > 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
> > 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
> > in VB6 ?
> > Your help is very urgent, I have a deadline !