从MS Access备注字段

时间:2015-05-31 10:24:31

标签: parsing access-vba ms-access-2013

我有一个MS Access 2013备忘录字段,用于保存文本版本 电子邮件。这是一个例子:

From: Simon Smith
To: Bob Brown
Date: 5/4/15 2:30PM
Subject: Draft Report 

Please find attached the draft report as discussed.

我想从电子邮件字段中提取数据(即"草稿报告");主题:"从备忘录字段到MS Access表单上的文本字段。

有人可以帮忙吗?

谢谢GM

1 个答案:

答案 0 :(得分:1)

确定。我用Instr和Mid想出来了。谢谢你的建议戈德。我确信有更好的方法可以做到但它有效!

Dim strStart As String
Dim strEnd As String

' figure out where the string starts
strStart = InStr(Me.EmailMemo, "Subject:") + 9

' figure out where the line ends by looking for a carriage return
strEnd = InStr(strStart, Me.EmailMemo, Chr(10))

' display the string
Me.EmailTitle = Mid(Me.EmailMemo, strStart, strEnd - strStart)