Read fields from .txt file and write to a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chaan
    New Member
    • Nov 2007
    • 1

    Read fields from .txt file and write to a table

    Hi,


    I have a text file as follows:

    a1,b1,c1,d1,09, 32,d1
    b2,c2,x1,d1,98, 21,x1
    s1,w2,e3,c4,78, 56,c1

    I want to read this .txt file and write to an Access table using VB6 coding.

    Please help me to solve this as soon as possible.

    RGDS.

    Chaan.
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Is every comma is your field?

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      You could use the text file import built into Access (pretty sure you can drive it from your code). But I think what Hari is getting at is that if you know that the commas only appear between your fields and not in the data, you can use the Split() function to split the text into an array based on the commas.

      Comment

      Working...