-
relink to relative path TXT data files
I have a access 2000 database (currently running jet3.6) that has linked TXT and CSV files
I need to be able to move the location of the database often, the linked data will always be in the same place /Rawdata/ relative to the MDB file
is there anyway this can be automated to relink into the current location?
Thank you for your attention
Toby
-
Provided you do not rename the data files or the data files location there should be no problem in just moving the database file. But if you move the database and the data files then you will need to relink the database to the data files in the new location.
Allan
-
need the code to relink to relative location
Thanks for your response
the drive may be different but the dir from the mdb will be the same (/rawdata)
I have the code to get the path, I know the names of the files I want to Relink, they are txt and CSV files.
I have tried the CONNECT = path name
but to no avail
any help much appereciated
Toby
-
more info about my problem to relink txt files
I am trying to relink to existing linked csv and txt files, although the location may be different it is always realtive to the mdb file
I have tried using the following code
(GetPath returns the location of the database, the data is stored in the /RAWDATA folder
the tdf.SourceTableName returns the name of the file i want relinked BHIFEE
strFileName returns:
C:\Users\toby\Documents\Clients\TDL Mick\July\RawData\BHIFEE.TXT
Private Sub cmdLinkNew_Click()
Dim strFileName$
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
If tdf.SourceTableName <> "" Then
strFileName = GetPath & "\RawData\" & tdf.SourceTableName
' tdf.Connect = strFileName
tdf.Connect = ";Text=" & strFileName
tdf.RefreshLink
End If
Next
End Sub
I get an INVALID argument error
any help on what I am doing wrong or how I may do this much appreciated.
Toby
-
more info
Originally Posted by Allan Murphy
Provided you do not rename the data files or the data files location there should be no problem in just moving the database file. But if you move the database and the data files then you will need to relink the database to the data files in the new location.
I am trying to relink to existing linked csv and txt files, although the location may be different it is always realtive to the mdb file
I have tried using the following code
(GetPath returns the location of the database, the data is stored in the /RAWDATA folder
the tdf.SourceTableName returns the name of the file i want relinked BHIFEE
strFileName returns:
C:\Users\toby\Documents\Clients\TDL Mick\July\RawData\BHIFEE.TXT
Private Sub cmdLinkNew_Click()
Dim strFileName$
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
If tdf.SourceTableName <> "" Then
strFileName = GetPath & "\RawData\" & tdf.SourceTableName
' tdf.Connect = strFileName
tdf.Connect = ";Text=" & strFileName
tdf.RefreshLink
End If
Next
End Sub
I get an INVALID argument error
any help on what I am doing wrong or how I may do this much appreciated.
Toby
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|