DAO code

My OS is win 7 prof 64 bit and I have office 365.  i have an ASCIi text file which has data in the following format :
James Doe (jDoe@gmail.com);
I want to read this file, line by line,
 1.  to read until before the ( and then copy and paste to a variable;
2   from (  ... ) to copy the email
3.  And then to open a table which has already been created, and append the 1. to a field called Xname; and the 2. to a field called yemail.  
4.  The end of the line is denoted by ";",
5. and continue processig until the end of the file.
has anyone a sample code that could do something like this or close to it, I would appreciate it.  Thank u.
jegajothyretiredAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieVBA ExpertCommented:
Couldn't you read the whole file into a table then use an update/append query to put/add the data into the 2 fields in the existing table?
0
Rey Obrero (Capricorn1)Commented:
test this code

Sub readText()
Dim rs As DAO.Recordset, s As String, strArr() As String
Set rs = CurrentDb.OpenRecordset("yourTable")

Open "C:\folderX\yourFile.txt" For Input As #1
Do Until EOF(1)
    Line Input #1, s
    With rs
        .AddNew
        !xName = Trim(Split(s, "(")(0))
        !yemail = Trim(Replace(Split(s, "(")(1), ");", ""))
        .Update
    End With

Loop
Close #1

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jegajothyretiredAuthor Commented:
This is the solution, I was expecting, and I wish to inform u that the solution works 100% correctly.  Thank u very much.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office 365

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.