Results 1 to 2 of 2

Thread: Tranfering data from text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    4

    Unhappy


    I am having a bit of a problem, perhaps someone might have a few ideas.....
    I am trying to convert data from a txt file which is in the following format:

    "143" "2007800002" 6 "0009924" "04105"
    "L2/BUP12461" 2 "" "BUP12461" "L2 BUP12461:PAR WOORIM" "" ""

    The data comes in pairs of lines like above and I can have up to 5000 of these in the one file that needs to be converted. The feilds are separated by a space. The feilds marked with "" are strings and ones without are integers. The tricky part now is that the table that the second line is to be converted is represented by the third feild of the top line (this feild is not placed in the database)

    Any insight you can give towards this problem would be greatly appreciated

    Regards
    Clayton Read
    [email protected]

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    I had no problem inputting all the fields with the following code - the rest is just adding a record based on whichever field you like - then looping until done

    Private Sub Form_Load()
    Dim Txt11, Txt12, Txt13, Txt14, Txt15
    Dim Txt21, Txt22, Txt23, Txt24, Txt25, Txt26, Txt27

    Open "text.txt" For Input As #1
    Input #1, Txt11, Txt12, Txt13, Txt14, Txt15
    Input #1, Txt21, Txt22, Txt23, Txt24, Txt25, Txt26, Txt27
    Close

    Text1 = Txt11
    Text2 = Txt12
    Text3 = Txt13
    Text4 = Txt14
    Text5 = Txt15

    Text6 = Txt21
    Text7 = Txt22
    Text8 = Txt23
    Text9 = Txt24
    Text10 = Txt25
    Text11 = Txt26
    Text12 = Txt27
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width