Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate Memo Field 1

Status
Not open for further replies.

Najemikon

Technical User
Mar 5, 2002
168
GB
Hi,

I run a support call logging system in Access and have added a method to create records based on emails sent by customers. The email body always has far too much information though and I'd like to know how to truncate it.

I have a macro in Outlook to copy the most recent Inbox email to a public folder. My database references this Exchange folder as a linked table, so all the email elements appear as fields. I use a recordset function to copy the relevant fields to my table then delete the email from the public folder. So far, so easy!

What I would to know is how can I change my simple code (essentially 'Access Subject Field = Outlook Email Body') to only read in the first paragraph? Or more accurately, detect double line spacing and not use anything beyond it?

I've gone into this detail in case any of you have a similar link between Outlook and Access. Are there any commands inherent to Outlook that could trim the text during the copy email macro, rather than letting Access deal with it?


Cheers!



Jon
 
Najemikon,
There are a couple of different ways to do this, as a calculated field in a query, or in a VBA macro. Either way the process is pretty much the same, here are couple of built-in functions you could use in a query to acheive this.

Find the Carrriage Return/Line Feed ([tt]vbCrLf or Chr(13) & Chr(10)[/tt]) character:
[tt]FirstCarriageReturn: InStr([YourField],Chr(13) & Chr(10))[/tt]

To pull the text use this in conjunction with [tt]Left()[/tt]:
[tt]FirstParagraph: Left([YourField], InStr([YourField],Chr(13) & Chr(10)))[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top