one text file in to two different table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • voroojak
    New Member
    • Feb 2007
    • 92

    one text file in to two different table

    I have a bog problem in access
    what i have to do is that
    i have a text file that i have to insert it into access. but the problem is that there is two differnt type of data in my text file.
    the one that have rpt:1 have differnt format of those who hast rpt:2. but they are all in one text file.
    what i want to di is that i want to say that when ever rpt is equal 1 put in this table and whenever the rpt is 2 put in the other table.

    i have to be able to read the text file and then send it into another table

    i would appreciate any help.
    thanks
  • JConsulting
    Recognized Expert Contributor
    • Apr 2007
    • 603

    #2
    Originally posted by voroojak
    I have a bog problem in access
    what i have to do is that
    i have a text file that i have to insert it into access. but the problem is that there is two differnt type of data in my text file.
    the one that have rpt:1 have differnt format of those who hast rpt:2. but they are all in one text file.
    what i want to di is that i want to say that when ever rpt is equal 1 put in this table and whenever the rpt is 2 put in the other table.

    i have to be able to read the text file and then send it into another table

    i would appreciate any help.
    thanks
    can you post a small sample of the data...and how it looks in the file?

    something like this may help out

    [code=vb]
    Function importtxtfile(s trFile As String) As Long
    Dim MyString As String
    Open strFile For Input As #1
    Do While Not EOF(1)
    Line Input #1, MyString
    'Here you can either parse your fields based on the delimiter
    'or you can use the instr(mystring, "xxx") to identify what table
    'then
    'use an insert statement to put the line into the proper table
    Loop
    Close #1 ' Close file.
    End Function
    [/code]
    J

    Comment

    • voroojak
      New Member
      • Feb 2007
      • 92

      #3
      i havent done that much
      i just create two tables with the fields.
      if the report tybe be 1 then have different field with rport type 2.
      also i dont wantt o enter all the fields that is in text field.
      and also in my text field in one line there is two field in other line there is 3 field.
      i may just need one field in one line and i also want to escape some lines.
      if i want to explain i have to same that cosider that theree is comment card that the customer has fill it.
      what i need is to get those fields that i need and then again go the next entry. this is a very big text file

      thanks alot

      Comment

      • JConsulting
        Recognized Expert Contributor
        • Apr 2007
        • 603

        #4
        Originally posted by voroojak
        i havent done that much
        i just create two tables with the fields.
        if the report tybe be 1 then have different field with rport type 2.
        also i dont wantt o enter all the fields that is in text field.
        and also in my text field in one line there is two field in other line there is 3 field.
        i may just need one field in one line and i also want to escape some lines.
        if i want to explain i have to same that cosider that theree is comment card that the customer has fill it.
        what i need is to get those fields that i need and then again go the next entry. this is a very big text file

        thanks alot
        There has to be rules when it comes to automating the import of data. Without those , I do not know how to help you. I understand that you don't need ALL data...but to exclude some, or choose some based on some logic...YOU have to define that that is. I'll monitor this question if you can come back with some definition of that that is.
        J

        Comment

        Working...