Stuart McLachlan
stuart at lexacorp.com.pg
Mon Apr 15 04:38:58 CDT 2013
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 >