[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

parsing text file

I am trying to parse a text file.  It will be a single line text file.  The format will be :

11234567890\ Name\ Address

I know about the domcd.transfertext but this isnt what I am looking for.  I also have some coding for parsing, but did not write it.  I have tried to learn about parsing and can not find any helpful links.  I am looking for some guidance on this issue.  The format above will go into an sql db.  The fist set of data will go into field PhoneNumber, the second will go into field Name, the third will go into field Address.  The \ is the delimiter and the space starts a new field.  Any help would be more than appreciated.

Thanks in advance!
0
russell12
Asked:
russell12
  • 2
1 Solution
 
jerryb30Commented:
One file? Many files is a single folder or folder tree? Any pattern to file name(s)?
0
 
russell12Author Commented:
There will be many files created.  The file name will be in .txt format with the phone number being the file name.  Example: 1234567890.txt; 1234567891.txt, 1234567892.txt, etc.  They will be located in a single folder called "calls".
0
 
Rey Obrero (Capricorn1)Commented:
here is sample code to parse the string and add them as record



dim str as string, strArr() , rs as dao.recordset

str="11234567890\ Name\ Address"

strArr=split(str,"\")

set rs=currentdb.openrecordset("tablename")

with rs
      .addnew
      !PhoneNumber=trim(strArr(0))
      !Name=trim(strArr(1))
      !adress=trim(strArr(2))
      .update
end with
0
 
russell12Author Commented:
Awesome!!  Thanks for putting me on the right track.  I should be able to use the code I do have and incorporate the 2 together to make it read the text file.  Thanks again!
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now