L
LarryP
I have a procedure that resets table links depending on the site that is
using the database. Most links are to Access tables in other databases, one
is to an Excel file, one to a .txt file. For the first two everything works
fine, but for the .txt file I'm getting an invalid path error. Since the
path IS valid, and the VBA is identical except for the "Text;" type
declaration, I'm stymied as to why the error. See partial code below:
Select Case Right(!TucsonTableLink, 3)
Case "xls":
tdfLinked.Connect = "Excel 8.0;HDR=YES;IMEX=2;DATABASE=" &
SessionFilePath & !TucsonTableLink
Case "txt":
tdfLinked.Connect = "Text;DATABASE=" & SessionFilePath &
!TucsonTableLink
Case "mdb":
tdfLinked.Connect = ";DATABASE=" & SessionFilePath &
!TucsonTableLink
End Select
........
tdfLinked.RefreshLink
#######THIS IS WHERE THE ERROR OCCURS.....########
At the point where the error occurs, the actual path looks like this:
\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\IPT Health Tool Source
Files\qn.txt
Except for the actual file name, that exact same path is used successfully
to link numerous other tables, so I'm darned if I can see why it blows up for
this file.
(By the way, off the subject, what's the type declaration for Excel 2003?
VBA Help only goes to Excel 8.0 for Excel 97.)
using the database. Most links are to Access tables in other databases, one
is to an Excel file, one to a .txt file. For the first two everything works
fine, but for the .txt file I'm getting an invalid path error. Since the
path IS valid, and the VBA is identical except for the "Text;" type
declaration, I'm stymied as to why the error. See partial code below:
Select Case Right(!TucsonTableLink, 3)
Case "xls":
tdfLinked.Connect = "Excel 8.0;HDR=YES;IMEX=2;DATABASE=" &
SessionFilePath & !TucsonTableLink
Case "txt":
tdfLinked.Connect = "Text;DATABASE=" & SessionFilePath &
!TucsonTableLink
Case "mdb":
tdfLinked.Connect = ";DATABASE=" & SessionFilePath &
!TucsonTableLink
End Select
........
tdfLinked.RefreshLink
#######THIS IS WHERE THE ERROR OCCURS.....########
At the point where the error occurs, the actual path looks like this:
\\apfs\projs\prodcntl_ops\Entrpris\Data\PRISM\IPT Health Tool Source
Files\qn.txt
Except for the actual file name, that exact same path is used successfully
to link numerous other tables, so I'm darned if I can see why it blows up for
this file.
(By the way, off the subject, what's the type declaration for Excel 2003?
VBA Help only goes to Excel 8.0 for Excel 97.)