Helgardh wrote:
I have a linked table (Access 2003) to an Outlook inbox. The body of
the e-mail messages are in a memo field. My problem is that I need to
"read" the memo and find data on certain lines.
The memo will look something like this:
Order: J123451
Placed By: Joe.systems,daily
Order: J123452
Placed By: John.systems,daily
Order: J123453
Placed By: Tom.engineering,daily
Order: J123454
Placed By: Joe.systems,weekly
I need to find each order number and create a Orders record (J12345)
in the
Orders table and write the detail to a OrdersDetail table that has a
"lookup
field" to the Orders Table.
How do I go about reading through the memo and finding/using the data
that I want?
I'd store the memo to a variable. Then I'd search for "Order:" Then
I'd Mid() it. Then I'd search for chr(10) + chr(13). Then I'd search
for the next "Order:". Anything between the two is specific to an
order. THen I'd move to the next group. If the second search returns a
0, then you are at the end of the list.
Ex:
S = Memo
Do while True
Start = Instr(s,"Order:")
If start > 0 then
'remove everthing up to and including "Order: "
s = Mid(s,Start + 6)
'find where the next "Order: " exists
End = Instr(s,"Order:")
'this is the string from the order# to next order#
'IOW, getting all data between "Order#" and "Order#"
If End > 0 then
ProcessOrder = Left(s,End-1)
Else
'at the end of the list
ProcessOrder = s
ENdif
...process order by parsing out the order info. Ex:
'Order: J123451
'Placed By: Joe.systems,daily
'now move to the next "Order: "
If End > 0 then
s = Mid(s,End)
Endif
Else
Exit DO
Endif
Loop