Linked dbaseIV-file in ACCESS to be relinked by VB 
Author Message
 Linked dbaseIV-file in ACCESS to be relinked by VB

        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
by using
my VB6-Application:
That dBase file is a fact and I can't echchange or import it. It is a
file which
is on a users computer already and is the base of a shopping basket for
the
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
is
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
coming
with my program as the user already has it !!)
The name is guaranteed, because the user cannot alter it. The location
however
is on his own. This file has only about 7 or 10 fields which is not
enough to
make a warehousing program, so I made a second additional file and
combine these
two in my program.
As you assume I have linked this 'Artikel.dbf' as external data into my
ACCESS.mdb .
By doing that, I automatically have set a certain pathname on my
machine, which
in some or many cases will not be identical with the one the user has
established.
That is the reason I have to relink this file from the new location.
That is
done by the user, because he knows where he put it. I know that there is
a way
to do this within ACCESS, but this will not help, if the user doesn't
have
ACCESS.
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
this
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
E-mail !

Quote:
> > This is the function:

> > > 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
> >               '/////How shall I alter here ???
> >               '/////The deletion works by using:
> >               '/////Set db = _
> >    OpenDatabase("c:\linktest\placeone\mymdb.mdb")
> >               '///// which I wanted to move

to........\placetwo\...for test purpose

- Show quoted text -

Quote:

> > >     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=" &
strSourceDB
> >                    '///// is probably not usable for a dbasefile to
be linked.
> > >     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
refresh
> > > 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 :

- Show quoted text -

Quote:
> > http://www.*-*-*.com/

> > 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
> > be relinked.
> > 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 addin-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 !



Sun, 14 Jul 2002 03:00:00 GMT  
 Linked dbaseIV-file in ACCESS to be relinked by VB
        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
by using
my VB6-Application:
That dBase file is a fact and I can't echchange or import it. It is a
file which
is on a users computer already and is the base of a shopping basket for
the
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
is
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
coming
with my program as the user already has it !!)
The name is guaranteed, because the user cannot alter it. The location
however
is on his own. This file has only about 7 or 10 fields which is not
enough to
make a warehousing program, so I made a second additional file and
combine these
two in my program.
As you assume I have linked this 'Artikel.dbf' as external data into my
ACCESS.mdb .
By doing that, I automatically have set a certain pathname on my
machine, which
in some or many cases will not be identical with the one the user has
established.
That is the reason I have to relink this file from the new location.
That is
done by the user, because he knows where he put it. I know that there is
a way
to do this within ACCESS, but this will not help, if the user doesn't
have
ACCESS.
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
this
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
E-mail !

Quote:
> > This is the function:

> > > 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
> >               '/////How shall I alter here ???
> >               '/////The deletion works by using:
> >               '/////Set db = _
> >    OpenDatabase("c:\linktest\placeone\mymdb.mdb")
> >               '///// which I wanted to move

to........\placetwo\...for test purpose

- Show quoted text -

Quote:

> > >     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=" &
strSourceDB
> >                    '///// is probably not usable for a dbasefile to
be linked.
> > >     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
refresh
> > > 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 :

- Show quoted text -

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
location
> > from the one my application is supposed to be, all linked files have
to
> > be relinked.
> > 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 addin-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 !



Sun, 14 Jul 2002 03:00:00 GMT  
 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
by using
my VB6-Application:
That dBase file is a fact and I can't echchange or import it. It is a
file which
is on a users computer already and is the base of a shopping basket for
the
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
is
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
coming
with my program as the user already has it !!)
The name is guaranteed, because the user cannot alter it. The location
however
is on his own. This file has only about 7 or 10 fields which is not
enough to
make a warehousing program, so I made a second additional file and
combine these
two in my program.
As you assume I have linked this 'Artikel.dbf' as external data into my
ACCESS.mdb .
By doing that, I automatically have set a certain pathname on my
machine, which
in some or many cases will not be identical with the one the user has
established.
That is the reason I have to relink this file from the new location.
That is
done by the user, because he knows where he put it. I know that there is
a way
to do this within ACCESS, but this will not help, if the user doesn't
have
ACCESS.
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
this
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
E-mail !

Quote:
> > This is the function:

> > > 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
> >               '/////How shall I alter here ???
> >               '/////The deletion works by using:
> >               '/////Set db = _
> >    OpenDatabase("c:\linktest\placeone\mymdb.mdb")
> >               '///// which I wanted to move

to........\placetwo\...for test purpose

- Show quoted text -

Quote:

> > >     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=" &
strSourceDB
> >                    '///// is probably not usable for a dbasefile to
be linked.
> > >     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
refresh
> > > 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 :

- Show quoted text -

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
location
> > from the one my application is supposed to be, all linked files have
to
> > be relinked.
> > 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 addin-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 !



Sun, 14 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Linked dbaseIV-file in ACCESS to be relinked by VB

2. Linked dbaseIV-file in ACCESS to be relinked by VB

3. Linked dbaseIV-file in ACCESS to be relinked by VB

4. embedding and linking files from VB to access database

5. Relink Access tables from code - not working!?

6. How to relink Access table

7. Relinking Access 97 tables using ADO

8. Relinking tables in Access with ADO

9. Help ADOX for ReLinking Dbase Table in Access

10. Relinking Access 97 tables using ADO...

11. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

12. DBaseIV : How to compact a DBase file ?

 

 
Powered by phpBB® Forum Software