Salakhetdinov Shamil
mcp2004 at mail.ru
Mon Apr 15 06:21:40 CDT 2013
Stuart seems to be away - let me try to help? That source code seems to be a VBA dialect? Try to edit source code and to use dim instead of local as well as Dim ff As Integer ff = VBA.FreeFile() instead of Freefile ff HTH. -- Shamil Понедельник, 15 апреля 2013, 12:51 от pedro at plex.nl: > >Hello Stuart, > >Thanks for the code. >i am trying to use it in a module, but i get an error on: > >While not EOF(#ff) > >and > >strOutputLine = replace(strTemp(" ",strDQ & "," & strDQ) > >i can't figure out why. > >Who can help me on this? > >Thanks > >Pedro > > > > > > > >Aircode written on line. May need some debugging! But the concept is there: > >Local ff as long >Local strTemp as string >Local strOutputLine as String >Local strResult as String >local strDQ as string >strDQ = Chr$(34) >Freefile ff > >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 > >On 15 Apr 2013 at 11:14, pedro at plex.nl wrote: > >> Dear members, >> >> i would like the text-file below imported in Access. >> Problem is that the text isn't divided in one rule by record and there are no text delimiters. >> The text between the ---------------- must be imported into one record. >> >> At the first text line a "space" can be used as divider, then the word "CONCLUSIE" and DIAGNOSES. >> >> I would like the result as following (quotes and ; as separation by field) >> >> "**";"T02-00423";"14-01-02";"pn:";"01234567,";"gb:";"01-01-22";"m";"(91jr)";"aa";"naam-";"Biopt schouder ....";"huid*biopt*geen afwijkingen" >> "**";"T02-01350"; ......................etc etc >> >> Wo cab help me? >> Thanks >> >> Pedro Janssen >> >> >> >> <text_file> >> >> ---------------------------------------------------------------------------- >> >> ** T02-00423 14-01-02 pn: 01234567, gb: 01-01-22 m (91jr) aa name- >> >> CONCLUSIE: >> Biopt schouder .... >> >> DIAGNOSES: >> huid*biopt*geen afwijkingen >> >> ---------------------------------------------------------------------------- >> >> ** T02-01350 06-02-02 pn: 07654321, gb: 01-01-68 v (33jr) A.W.G.J. name2-name3 >> >> CONCLUSIE: >> Huidexcisie linker ...... >> >> DIAGNOSES: >> huid*excisie*melanoom >> >> >> </text_file> >> -- >> 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