Results 1 to 2 of 2

Thread: extract specific data from txt file

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2018

    extract specific data from txt file

    hi can u help me with this project.
    to extrtact specific file like date, time, cardnumber, issuer no, account no etc.
    this is a multiple file.

     15:34:05 NOTES STACKED
     15:34:09 CARD TAKEN
     15:34:13 NOTES PRESENTED 1,2,1,0
     15:34:15 NOTES TAKEN
    DATE-TIME : 08/17/17-16:50:15
    ATM ID/SEQ NO. : 63006131/8846
    ISSUER NO. : 639403
    CARD NUMBER : 130000191826
    ACCOUNT NO. : 001101302000
    AMT REQ. : 1,700.00
    AMT AUTH. : 1,700.00
    TRACE NUMBER : 269459
     15:34:25 TRANSACTION END
    ![17-08-17 15:34:25]ACCUMM COUNTER VALUES :1:2:1:0

  2. #2
    Join Date
    Dec 2004

    Re: extract specific data from txt file

    you can try like
    Open "c:\temp\card2.txt" For Input As 1
    scard = Input(LOF(1), #1)
    Close 1
    pos = 1
        pos = InStr(pos, scard, "DATE-TIME")
        If pos = 0 Then MsgBox ("no more transactions"): Exit Do
        pos2 = InStr(pos, scard, "TRANSACTION END")
        If pos2 = 0 Then MsgBox ("no transaction end"): Exit Do
        stran = Mid(scard, pos, pos2 - pos)
        pos = pos2
        adetails = Split(stran, vbNewLine)
        dt = Mid(adetails(0), 13, 17)  ' parse the date detail from array
        ' all details for one transaction should be in the array adetails
        ' here you need parse the required items from the array to assign the values to your database
    this would not work for your previous sample of file as no transaction end
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed

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