G
G
I have a folder with about 500 files that need to be linked in my database.
To do this manually for each one is too time consuming. I have created an
import spec and used some code from other posts in this group.
It will link the first text file, but on the next loop I get "invalid
procedure call or argument" on the line "sfname = Dir".
Here's my code:
Dim sdir As String
Dim sfname As String
Dim spath As String
Dim sspec As String
spath = "C:\Documents and Settings\Owner\My Documents\CJ\15181\"
sfname = Dir("*.txt")
Do While Len(sfname) > 0
DoCmd.TransferText acLinkDelim, "Link Spec", Left(sfname,
Len(Dir(sfname)) - 4), Dir & sfname, True
MsgBox ("file is linked")
sfname = Dir
Loop
I appreciate any assistance you can give.
To do this manually for each one is too time consuming. I have created an
import spec and used some code from other posts in this group.
It will link the first text file, but on the next loop I get "invalid
procedure call or argument" on the line "sfname = Dir".
Here's my code:
Dim sdir As String
Dim sfname As String
Dim spath As String
Dim sspec As String
spath = "C:\Documents and Settings\Owner\My Documents\CJ\15181\"
sfname = Dir("*.txt")
Do While Len(sfname) > 0
DoCmd.TransferText acLinkDelim, "Link Spec", Left(sfname,
Len(Dir(sfname)) - 4), Dir & sfname, True
MsgBox ("file is linked")
sfname = Dir
Loop
I appreciate any assistance you can give.