msaccesspatc
Registered User.
- Local time
- Today, 01:34
- Joined
- Aug 26, 2012
- Messages
- 12
It's likely most anyone can help with this. I know very little and need to debug this. I have a form written by another person that converts a pipe '|' file to tab delimited. When i execute there's an error of 'Compile error: user-defined type not defined.
It highlights the 3rd line below show here in red
Option Compare Database
Option Explicit
Public objFSO As New FileSystemObject
Public Function ConvertFile(tcFileIn As String, tcFileOut As String)
Dim objStreamRead As Scripting.TextStream
Dim objStreamWrite As Scripting.TextStream
Dim lcLine As String
Dim laLine() As String
Dim lcField As String
Dim i As Integer
Set objStreamWrite = objFSO.CreateTextFile(tcFileOut)
Set objStreamRead = objFSO.OpenTextFile(tcFileIn)
Do Until objStreamRead.AtEndOfStream
lcLine = objStreamRead.ReadLine
laLine = Split(lcLine, "|")
lcLine = ""
For i = 1 To UBound(laLine)
lcField = Trim(laLine(i))
If Right(lcField, 1) = Chr(10) Then
lcField = Trim(Left(lcField, Len(lcField) - 1))
End If
lcLine = lcLine & lcField & Chr(9)
i = i + 1
Next i
objStreamWrite.Write (lcLine) & Chr$(10)
Loop
End Function
In reading some threads, it says that i need to remove the references in tools and apply (check off) the correct references. I have no idea which ones that would be to correct this compile error.
any help is much appreciated in trying to increase my access knowledge.
thanks
msaccesspatc
It highlights the 3rd line below show here in red
Option Compare Database
Option Explicit
Public objFSO As New FileSystemObject
Public Function ConvertFile(tcFileIn As String, tcFileOut As String)
Dim objStreamRead As Scripting.TextStream
Dim objStreamWrite As Scripting.TextStream
Dim lcLine As String
Dim laLine() As String
Dim lcField As String
Dim i As Integer
Set objStreamWrite = objFSO.CreateTextFile(tcFileOut)
Set objStreamRead = objFSO.OpenTextFile(tcFileIn)
Do Until objStreamRead.AtEndOfStream
lcLine = objStreamRead.ReadLine
laLine = Split(lcLine, "|")
lcLine = ""
For i = 1 To UBound(laLine)
lcField = Trim(laLine(i))
If Right(lcField, 1) = Chr(10) Then
lcField = Trim(Left(lcField, Len(lcField) - 1))
End If
lcLine = lcLine & lcField & Chr(9)
i = i + 1
Next i
objStreamWrite.Write (lcLine) & Chr$(10)
Loop
End Function
In reading some threads, it says that i need to remove the references in tools and apply (check off) the correct references. I have no idea which ones that would be to correct this compile error.
any help is much appreciated in trying to increase my access knowledge.
thanks
msaccesspatc