L
lmv
I am pasting 4 lines of text into a text box from a search in YELLOWPAGES.COM
LastName, FirstName
1234 streetname rd
City, state, 00000-0000
(000-000-0000)
I have 3 parse buttons to fill that text into fields on my form. Here is my
proceedure.
I paste it in my notes field then cut the address through the phone and hit
my parse button
then I paste address through end of line and parse2
paste the rest delete city and state and get the zip code and phone on the
same
line then parse3 (I don't try to use city and state because they are a
different table and they are numbers not text in the fields on the table this
form is based on)
The following parse buttons work independently but I need to COMBINE them
and I don't know how. I do NOT KNOW if the code for the end line is vbCrLf or
?? and I don't know how to find out. So I understand I may have to try
different options but my problem is I don't know how to combine the whole
thing together to even begin.
Can someone help?
Private Sub cmdParse_Click()
On Error GoTo Err_cmdParse_Click
Dim strName As String
Dim strFName As String
Dim strLName As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strName = Me.Notes.Text
intLoc = InStr(1, strName, " ")
strLName = Left(strName, intLoc - 2)
strFName = Right(strName, Len(strName) - intLoc)
Me.FirstName.SetFocus
Me.FirstName.Text = strFName
Me.LastName.SetFocus
Me.LastName.Text = strLName
End If
Me.Notes = "" 'clears the notes field
Exit_cmdParse_Click:
Exit Sub
Err_cmdParse_Click:
MsgBox Err.Description
Resume Exit_cmdParse_Click
End Sub
'-------------------------------------------------------------------
' cmdParse2_Click()
On Error GoTo Err_cmdParse2_Click
Dim strAddress As String
Dim strFAddress As String
Dim strLAddress As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strAddress = Me.Notes.Text
intLoc = InStr(1, strAddress, " ")
strLAddress = Left(strAddress, intLoc)
strFAddress = Right(strAddress, Len(strAddress) - intLoc)
Me.streetnumber.SetFocus
Me.streetnumber.Text = strLAddress
Me.StreetName.SetFocus
Me.StreetName.Text = strFAddress
End If
Me.Notes = ""
' --------------rest of parse2 code omited for post
'---------------cmdParse3_Click()
On Error GoTo Err_cmdParse3_Click
Dim strFInfo As String
Dim strPhoneNumber As String
Dim strRPhoneNumber As String
Dim strzipcode As String
Dim strLzipcode As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strFInfo = Me.Notes.Text
intLoc = InStr(1, strFInfo, " ")
strLzipcode = Left(strFInfo, intLoc)
strRPhoneNumber = Right(strFInfo, Len(strFInfo) - intLoc)
Me.ZipCode.SetFocus
Me.ZipCode.Text = strLzipcode
Me.PhoneNumber.SetFocus
Me.PhoneNumber.Text = strRPhoneNumber
End If
Me.Notes = ""
--------------rest of parse3 code omited for post
LastName, FirstName
1234 streetname rd
City, state, 00000-0000
(000-000-0000)
I have 3 parse buttons to fill that text into fields on my form. Here is my
proceedure.
I paste it in my notes field then cut the address through the phone and hit
my parse button
then I paste address through end of line and parse2
paste the rest delete city and state and get the zip code and phone on the
same
line then parse3 (I don't try to use city and state because they are a
different table and they are numbers not text in the fields on the table this
form is based on)
The following parse buttons work independently but I need to COMBINE them
and I don't know how. I do NOT KNOW if the code for the end line is vbCrLf or
?? and I don't know how to find out. So I understand I may have to try
different options but my problem is I don't know how to combine the whole
thing together to even begin.
Can someone help?
Private Sub cmdParse_Click()
On Error GoTo Err_cmdParse_Click
Dim strName As String
Dim strFName As String
Dim strLName As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strName = Me.Notes.Text
intLoc = InStr(1, strName, " ")
strLName = Left(strName, intLoc - 2)
strFName = Right(strName, Len(strName) - intLoc)
Me.FirstName.SetFocus
Me.FirstName.Text = strFName
Me.LastName.SetFocus
Me.LastName.Text = strLName
End If
Me.Notes = "" 'clears the notes field
Exit_cmdParse_Click:
Exit Sub
Err_cmdParse_Click:
MsgBox Err.Description
Resume Exit_cmdParse_Click
End Sub
'-------------------------------------------------------------------
' cmdParse2_Click()
On Error GoTo Err_cmdParse2_Click
Dim strAddress As String
Dim strFAddress As String
Dim strLAddress As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strAddress = Me.Notes.Text
intLoc = InStr(1, strAddress, " ")
strLAddress = Left(strAddress, intLoc)
strFAddress = Right(strAddress, Len(strAddress) - intLoc)
Me.streetnumber.SetFocus
Me.streetnumber.Text = strLAddress
Me.StreetName.SetFocus
Me.StreetName.Text = strFAddress
End If
Me.Notes = ""
' --------------rest of parse2 code omited for post
'---------------cmdParse3_Click()
On Error GoTo Err_cmdParse3_Click
Dim strFInfo As String
Dim strPhoneNumber As String
Dim strRPhoneNumber As String
Dim strzipcode As String
Dim strLzipcode As String
Dim intLoc As Integer
Me.Notes.SetFocus
If Me.Notes.Text <> "" Then
strFInfo = Me.Notes.Text
intLoc = InStr(1, strFInfo, " ")
strLzipcode = Left(strFInfo, intLoc)
strRPhoneNumber = Right(strFInfo, Len(strFInfo) - intLoc)
Me.ZipCode.SetFocus
Me.ZipCode.Text = strLzipcode
Me.PhoneNumber.SetFocus
Me.PhoneNumber.Text = strRPhoneNumber
End If
Me.Notes = ""
--------------rest of parse3 code omited for post