Stuart McLachlan
stuart at lexacorp.com.pg
Wed Apr 17 03:46:08 CDT 2013
I told you yesterday. Replace: strResult = strResult & vbCrLf & strOutput with: strResult = strResult & vbCrLf & strOutputLine and: delete DIm strOutput as String And next time, don't just paste "aircode" into a module and hope that it works without analysing it and at least trying to work out what it is supposed to do. -- Stuart On 17 Apr 2013 at 9:42, pedro at plex.nl wrote: > > No one any idea what is going wrong in the code? > > Thanks Pedro > > > > 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\Test_Import.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 > > > > > > > > > > > > > > > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > > > Indeed the result is empty. > When i use F8, and put the cursor on all the variables, everyone is empty (=""). > > What is going wrong in the code??? > > Thanks > > Pedro > > > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > > > Tells you strResult is probably null. Try MsgBox "*" & strResult & "*" to > verify. > > If it's empty, try the breakpoint/F8/hover over the variable trick I just > posted. Maybe you'll find the place where the code is failing. > > R > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of pedro at plex.nl > Sent: Tuesday, April 16, 2013 2:17 PM > To: AccessD at databaseadvisors.com > Subject: Re: [AccessD] import text > > I also tried this before, and the only thing that happens is that a > messagebox pops up, with a "ok" button. But when i click on it nothing > happens??? > > > > > > > What do you get if you change > Debug.Print strResult > to > Msgbox strResult? > > > > On 16 Apr 2013 at 13:51, pedro at plex.nl wrote: > > > Paul en Stuart, > > > > when i press Ctrl + G, the direct Window opens, but it is empty?? > > > > > > Thanks Pedro > > > > > > -- > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >