Create DB from .txt document

S

sand man

Lname, Fname MI
City, ST
###-###-####, Pro 3
##
Lname, Fname MI
City, ST
###-###-####, Pro 2
##
Lname, Fname MI
City, ST
###-###-####, Pro 2
##
Lname, Fname MI
City, ST, Pro 3
##
Lname, Fname MI
City, ST, Pro 3

This is a sample of over 12,000 records in a txt file. The ## is the
record separator, the ###-###-#### is the phone number.
I am trying to make a simple delimited database.

The main problem is not all records have a phone number, so I can't
just tell a macro to move down 3 lines and insert a comma.

The next problem is that the pro rating is at the end of the phone
line in some records and at the end of the city, state in other
records. This is dependent on whether there is a phone number.

I would like to (I think) move to the third line, check if a digit 0-9
exists.
If yes, move to next record.
If no, insert a line or maybe a 111-111-1111 place holder.

Of course I still have to deal with getting the pro rating in the
proper place too.

Any help is tremendously appreciated.

Kevin
 
D

Doug Robbins - Word MVP

Use Edit>Replace to replace ^p with ^t and then use it again to replace
^t##^t with ^p

Each record should then be in a separate paragraph with each element of the
record separated by a tab space.

Also see "Convert Labels into Mail Merge Data File" on fellow MVP Graham
Mayor's website at:

http://www.gmayor.com/convert_labels_into_mail_merge.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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