Hi,
The Line Input #n,aString command will read an entire line (as long as it's 
terminated by a CR/LF) even if it has commas in it.

Ian



  ----- Original Message ----- 
  From: HouseDad 
  To: [email protected] 
  Sent: Tuesday, February 22, 2005 8:34 AM
  Subject: [vbhelp] Re-inventing the Wheel





       Ok, I know it's "going backwards in time" but I have a simple 
  question which hopefully has a simple answer.

       I process a lot of CSV format files.  Currently, when I read the 
  data, I have problems when there's a COMMA in the middle of a field, 
  since the INPUT command treats it as a new field, even though it's 
  not delimited by QUOTES.

       A few programs in the past I have gotten around this by reading 
  the file one character at a time and looking for the commas, then I 
  strip the quotes from the build string.  To me, this is really 
  reinventing the wheel.

       Most of the programs, I just use an INPUT statement like 
  aforementioned, then I pop up an error box showing the last good 
  record when an extra comma has caused the order of fields being read 
  to be altered.

       For some reason, on a regular file opened for INPUT, I was 
  thinking I could use GET to read the field, but that doesn't work, 
  except for pre-defined fields in a RANDOM access statement.

       A couple of ways I can get around this are re-writing the 
  programs to utilize ADO ( I am assuming ADO has no problem 
  recognizing that a comma in-between two quotes is part of the field), 
  reading the file one byte at a time, or reading the data from EXCEL.

       Reading the data from EXCEL would work great except this 
  particular file I have to process has 200k records and EXCEL won't 
  load the whole thing.  I know I could split it, but I am hoping there 
  is an easy way to read the data directly from the file.

       I definitely plan on going ADO in the future but can't take the 
  time to do that right now in the middle of the project.

       Any ideas?

  [C]








  '// =======================================================
      Rules : http://ReliableAnswers.com/List/Rules.asp
      Home  : http://groups.yahoo.com/group/vbHelp/
      =======================================================
      Post  : [email protected]
      Join  : [EMAIL PROTECTED]
      Leave : [EMAIL PROTECTED]
  '// =======================================================



        Yahoo! Groups Sponsor 
         
        Get unlimited calls to

        U.S./Canada
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]




'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to