Outlook Restrict Method From Access

johnnyc

Registered User.
Local time
Today, 13:41
Joined
Sep 23, 2014
Messages
26
Hey Guys,

There are different reasons why I am looking for this to happen but basically i have the below script:

For Each Item In offexchfldr.Items.Restrict("[SenderName] = '" & frmfm & "'") ' Select Items that match Sender Name on form
If Item.TaskSubject = subid Then
Item.Categories = frmcat ' Update category from form to outlook
Item.Save
End If
Next


This script checks every item in the outlook inbox where the item.SenderName = my database sendername

This works every time except for when the sendername has quotes or single quotes in their name. So i am trying to utlize the replace method on the item sendername before trying to find the items in the inbox but its not working. Below is my attempt that does not work.

Thanks for your help guys!!

For Each Item In offexchfldr.Items.Restrict("Replace([SenderName],',"") = '" & frmfm & "'") ' Select Items that match Sender Name on form
 
The a Replace would look like:

Replace([SenderName], "'", "")
 
Hey Paul,

that is true but because its in the restrict string, that also errors.
 

Users who are viewing this thread

Back
Top Bottom