lmv said:
I have fixed the comma problem according to your code.
Now I will work on the how to move to the next line
At the moment I have 2 parse buttons one for the NAME another for the
ADDRESS but I am just copying each line in seperately from superpages.
Obviously, in the "real world" you won't want to spend the extra time of
copying and parsing each line separately -- read the entire name/address
information and paste it into an unbound text box, from which you will work,
the parse out all the information from that name/address information. If
you should have one that is only name plus telephone number, you are going
to have to handle it manually, or perhaps that might be common enough that
you would just create a separate sequence for name and phone alone.
Sorry if my restating the problem was an annoyance, I had
no idea what the coding used by the phonebook search would
be as to what form it returned the address and didn't know how
anyone would know that offhand (if you didn't work for them).
It wasn't so much an annoyance as a delay... but now I explained, I think,
how you can check it. That will determine how you find the next line.
Assume that you determine that the end-of-line or new-line used is the
intrinsic constant vbCrLf which is the combination of Chr$(13) & Chr$(10)...
to extract the address line from the entire string, you might use... if you
have pasted the entire name/address into a text box called txtWholeShebang,
use something like this:
Dim intAddrStartLoc as Integer
Dim intAddrEndLoc as Integer
Dim strTheAddrPart as String
intAddrStartLoc = InStr(Me.txtWholeShebang, vbCrLf)+2
intAddrStartLoc = InStr(intAddrStartLoc,Me.txtWholeShebang, vbCrLF)-1
strTheAddrPart = Mid(strTheWholeShebang, intAddrStartLoc,
intAddrEndLoc - intAddrStartLoc + 1)
and then follow this for each line... the previous location of the vbCrLf
for the previous line, plus two, will give you the start of the next line.
The last line may or may not be followed by a vbCrLf, so you'll just have to
explore whether it does, does not, or is consitent.
on the City, ST zip line you will have to do additional searching on comma
and space to extract the parts. As you are not going to try to do any
calculations on the zip and phone, I'd leave them exactly as is... it will
be pretty easy for a human to mentally process them, perhaps not so easy to
write code to try to shape-up the formatting.
I restated the problem thinking I wasn't clear. But, I quess the
answer should be whatever ACCESS uses since when you
copy from anywhere and paste into ACCESS what does it
use to make it go to the next line?
No, that would seem to make sense, but it doesn't necessarily follow -- as I
stated... there's not an "industry-standard" convention for that... and
Office, including Access, tries to be "considerate" and will properly
display some other formats.
In any case I really appreciated the input.
Thanks for your kind words. If you have additional questions, feel free to
follow up, making the question as specific as you can.
Larry Linson
Microsoft Office Access MVP