Paul Hartland
paul.hartland at googlemail.com
Tue Apr 16 06:15:12 CDT 2013
As Stuart mentioned you still have the line FreeFile ff when it should be ff = FreeFile Paul On 16 April 2013 14:03, <pedro at plex.nl> wrote: > > This is the function: > > > <module1> > > > Option Compare Database > Option Explicit > > Public Function melanomen() > > Dim ff As Integer > Dim strTemp As String > Dim strOutputLine As String > Dim strResult As String > Dim strDQ As String > Dim strFilename As String > Dim strOutput As String > FreeFile ff > strDQ = Chr$(34) > > strFilename = "C:\Temp\TestImport.txt" > > Open strFilename For Input As #ff > Line Input #ff, strTemp > > While Not EOF(ff) > If Left$(strTemp, 2) = "**" Then 'Build initial quote/comma delimited > string > strOutputLine = Replace(strTemp, " ", strDQ & "," & strDQ) > 'add start and end quotes > strOutputLine = strDQ & strOutputLine & strDQ > End If > > If Left$(strTemp, 10) = "CONCLUSIE:" Then 'Get next line > Line Input #ff, strTemp > strOutputLine = strOutputLine & "," & strDQ & strTemp & strDQ > End If > > If Left$(strTemp, 10) = "DIAGNOSES:" Then 'Get next line > Line Input #ff, strTemp > strOutputLine = strOutputLine & "," & strDQ & strTemp & strDQ > 'and append this line > strResult = strResult & vbCrLf & strOutput > End If > > Line Input #ff, strTemp > Wend > Close #ff > Debug.Print strResult > > End Function > > > </module> > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- Paul Hartland paul.hartland at googlemail.com