Converting Pipe Delimited Text File To Tab Delimited Text file

P

Probie Coder

I am new to MS Access and was wondering how to perform the following task.

How to write a program to convert pipe delimited text file to a tab
delimited text file.
All fields must be trimmed of extra spaces (I assume either the TRIM, LTRIM
OR RTRIM commands can be used for this. A form to specify the input and
output and a button to run the conversion is required for this task.

Any assistance you can offer would be greatly appreciated!
 
S

Stefan Hoffmann

M

Magius96

Here's an alternative. Call this function with the full path and filename of
the input file and the output file, and it'll do the rest. (I just wrote
this, and haven't tested it)

Function PipeToTab(ByVal InputFile As String, ByVal OutputFile As String)
Dim ThisString As String
Dim NewString As String
Dim A As Integer
Open InputFile For Input As InFile
Open OutputFile For Output As OutFile

While Not EOF(InFile)
NewString = ""
Line Input #InFile, ThisString
For A = 0 To Len(ThisString)
If Mid(ThisString, A, 1) = "|" Then
NewString = NewString & Chr$(9)
Else
NewString = NewString & Mid(ThisString, A, 1)
End If
Next

Print #OutFile, ThisString
Loop
End Function
 
S

Stefan Hoffmann

hi,
Here's an alternative. Call this function with the full path and filename of
the input file and the output file, and it'll do the rest. (I just wrote
this, and haven't tested it)
It doesn't handle pipes when they are the actual payload.

mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top