I have a webform that returns an email similar to the example though the data is on the next line instead of after. Is there a way to retrieve that data with small changes to the code? Thanks.
eg.
Name Tom Johnson Phone 555-555-5555 Email
Address 555 12th S
Scott Axton 2 years ago
Access Developer 30, which I see you have, discusses File I/O and converting your data for import more in depth.
Without seeing the code you have currently we can't really advise how to tweak it to do what you need. You probably need to post a snippet of your code or screen shots of same.
Travis HagenOP 2 years ago
Hi Scott. Thanks for the reply. I'll check out Developer 30. This is 100% Richards code and I haven't tried to use it yet. It's purpose is to Parse data from an incoming emails table, in my case to collect new customer webform data. He searched for a string then selected the following data on that same line. I want to search for a string then select the data on the following line. Here is his code:
Private Function CheckForString(inS As String, inLookFor As String) As String
Dim P As Integer
Dim S As String, LookFor As String
S = inS
LookFor = inLookFor
P = InStr(S, LookFor)
If P <> 0 Then
S = Trim(Right(S, Len(S) - P - Len(LookFor) + 1))
Else
S = ""
End If
CheckForString = S
End Function
Private Sub Command1_Click()
Dim DB As Database
Dim RS As Recordset, RSout As Recordset
Dim MsgBody As String
Dim FF
Dim OneLine As String, S As String, P As Integer
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("IncomingT", dbOpenDynaset)
Set RSout = DB.OpenRecordset("ResponseT", dbOpenDynaset)
FF = FreeFile
While Not RS.EOF
RSout.AddNew
MsgBody = RS!MsgBody
Open "C:\Users\Richard\Desktop\TempFile.TXT" For Output As #FF
Print #FF, MsgBody
Close #FF
Open "C:\Users\Richard\Desktop\TempFile.TXT" For Input As #FF
While Not EOF(FF)
Line Input #FF, OneLine
S = CheckForString(OneLine, "First Name:")
If S <> "" Then RSout!FirstName = S
S = CheckForString(OneLine, "Last Name:")
If S <> "" Then RSout!LastName = S
S = CheckForString(OneLine, "Address:")
If S <> "" Then RSout!Address = S
S = CheckForString(OneLine, "City:")
If S <> "" Then RSout!City = S
S = CheckForString(OneLine, "State:")
If S <> "" Then RSout!State = S
S = CheckForString(OneLine, "ZIP:")
If S <> "" Then RSout!ZIP = S
S = CheckForString(OneLine, "Phone:")
If S <> "" Then RSout!Phone = S
Wend
Close #FF
RSout.Update
RS.MoveNext
Wend
RS.Close
Set RS = Nothing
Set DB = Nothing
MsgBox "Done."
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM IncomingT"
DoCmd.SetWarnings True
End Sub
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Email Seminar Lessons.
The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.