D
DavidS
Hi
I'm try to apply the code as suggested Microsofts Knowledge Base Article-306144 however I get a Complie Error: Expected: Identifier. The purpose is to create a copy of a text file with an extentsion (ie tsv) that MS-Access does not recognise
The issue seems to be on the first line/string that I wrote as follows
Sub DataImport("c:\TablePayment.tsv", "MyTableData"
Also, do I need to replace any other parts of the code with my own name (ie strPath & strTableName)
Any suggestions would be really appreciated. Dav
The code is from
http://support.microsoft.com/default.aspx?scid=kb;EN-GB;306144#appliest
Sub DataImport(strPath As String, strTableName As String
'Variables used to create and modify the file extensio
Dim objFileSyste
Dim objFil
Dim strFileCopy As Strin
Dim intExtPosition As Intege
'Create an instance of the FileSystemObject to acces
'the local file syste
Set objFileSystem = CreateObject("Scripting.FileSystemObject"
'Use the GetFile method to return a File object corresponding to th
'file in a specified path
Set objFile = objFileSystem.GetFile(strPath
intExtPosition = InStr(objFile.Name, "."
If intExtPosition > 0 The
strFileCopy = Left(objFile.Name, intExtPosition - 1) & ".txt
Els
strFileCopy = objFile.Name & ".txt
End I
'Create a copy of the file with a .txt extensio
objFile.Copy strFileCopy, Tru
DoCmd.TransferText acImportDelim, , strTableName, strFileCopy, Tru
End Su
I replaced the first
I'm try to apply the code as suggested Microsofts Knowledge Base Article-306144 however I get a Complie Error: Expected: Identifier. The purpose is to create a copy of a text file with an extentsion (ie tsv) that MS-Access does not recognise
The issue seems to be on the first line/string that I wrote as follows
Sub DataImport("c:\TablePayment.tsv", "MyTableData"
Also, do I need to replace any other parts of the code with my own name (ie strPath & strTableName)
Any suggestions would be really appreciated. Dav
The code is from
http://support.microsoft.com/default.aspx?scid=kb;EN-GB;306144#appliest
Sub DataImport(strPath As String, strTableName As String
'Variables used to create and modify the file extensio
Dim objFileSyste
Dim objFil
Dim strFileCopy As Strin
Dim intExtPosition As Intege
'Create an instance of the FileSystemObject to acces
'the local file syste
Set objFileSystem = CreateObject("Scripting.FileSystemObject"
'Use the GetFile method to return a File object corresponding to th
'file in a specified path
Set objFile = objFileSystem.GetFile(strPath
intExtPosition = InStr(objFile.Name, "."
If intExtPosition > 0 The
strFileCopy = Left(objFile.Name, intExtPosition - 1) & ".txt
Els
strFileCopy = objFile.Name & ".txt
End I
'Create a copy of the file with a .txt extensio
objFile.Copy strFileCopy, Tru
DoCmd.TransferText acImportDelim, , strTableName, strFileCopy, Tru
End Su
I replaced the first