inserting text data

S

shank

I have the below text that is generated by a shipping company and sent to me
in an email. What is the shortest step(s) I can take to get this data into a
database? Way to much effort to cut-n-paste each field. Is there a way to
get a query to read a text file and parse the below? Can it be dumped into a
memo field and parsed? I'm guessing I would want everything beyond a <colon
space> on each line. How would I do that?

thanks!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
========= GENERAL INFORMATION =========

Merchant : Sales
Date/Time : 15-Aug-2005 10:51:53 AM

========= ORDER INFORMATION =========
Invoice : 511276
Description : SPJ,Mail Order
Amount : 18.95 (USD)
Payment Method : Visa

==== BILLING INFORMATION ===
Customer ID : 936542
First Name : Bob
Last Name : Smith
Company : No Company
Address : 123 Anywhere St
City : Chicago
State/Province : IL
Zip/Postal Code : 33333
Country : USA
Phone :
Fax :
E-Mail : (e-mail address removed)

==== SHIPPING INFORMATION ===
First Name : John
Last Name : Doe
Company :
Address : 123 Anywhere St
City : New York
State/Province : NY
Zip/Postal Code : 10000
Country : USA
 
D

David Lloyd

One alternative is to use a text file and then read the text file
line-by-line. You can then use a Select or If..Then...ElseIf block to look
for the description (e.g. "Merchant") and take every the value after the
colon. Once you have the values you can use ADO, or another method, to
insert the values into a table.

The following KB article gives more information on reading a text file
line-by-line.

http://support.microsoft.com/default.aspx?scid=kb;en-us;151262

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I have the below text that is generated by a shipping company and sent to me
in an email. What is the shortest step(s) I can take to get this data into a
database? Way to much effort to cut-n-paste each field. Is there a way to
get a query to read a text file and parse the below? Can it be dumped into a
memo field and parsed? I'm guessing I would want everything beyond a <colon
space> on each line. How would I do that?

thanks!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
========= GENERAL INFORMATION =========

Merchant : Sales
Date/Time : 15-Aug-2005 10:51:53 AM

========= ORDER INFORMATION =========
Invoice : 511276
Description : SPJ,Mail Order
Amount : 18.95 (USD)
Payment Method : Visa

==== BILLING INFORMATION ===
Customer ID : 936542
First Name : Bob
Last Name : Smith
Company : No Company
Address : 123 Anywhere St
City : Chicago
State/Province : IL
Zip/Postal Code : 33333
Country : USA
Phone :
Fax :
E-Mail : (e-mail address removed)

==== SHIPPING INFORMATION ===
First Name : John
Last Name : Doe
Company :
Address : 123 Anywhere St
City : New York
State/Province : NY
Zip/Postal Code : 10000
Country : USA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top