TextBox Parser

kLAcK

Registered User.
Local time
Yesterday, 23:57
Joined
Jun 22, 2007
Messages
19
I get emails every day with leads. Usually I cut and paste each field into a form in access, but this has become very time consuming. I want to be able to just paste the lead into a text box and have access parse the content and add the lead to the database.

Leads come in the following format:
Code:
DBA: Sample DBA Name
Legal_Name: Sample Legal Name
Physical_Address: 123 Any Street
City: Any City
State_Province: NV
Postcode: 5555555
Country: USA
Contact: John Doe

So I know I need to program a parser to read each line from the textbox and get the value for each field. Can someone point me in the right direction?

How do I begin reading each character in the text box, stop at a line break, get the value, and then continue?

I could swear I found a great example of this before on the board, but can't seem to find it right now.
 
Do you know about string functions, like Len(), Left()/Right(), InStr()? If not, look at Access help or search the forum for explanation on what they do.

Here's an example to start with:

Code:
If Left(MyString, 4) = "DBA:" Then
    TruncuatedString = Right(MyString, Len(MyString)-4)
End If
 
Thank you for the reply. I know these string functions, but what I don't know is how to grab the first line of a text box and put that into a string. And then grab the next line in a text box etc...
 
I'm not sure where you are getting the text from, but if it has a vbCrLf (Carriage Return and Line Feed), I think you should be able to parse for this... Have you tried?

Try and split the string into arrays using Split() function, with vbCrLf as the character to split the string with.
 
Ah thank you, forgot about the split function. I will give it a try.
 

Users who are viewing this thread

Back
Top Bottom