.findfirst searchtext problem

Nishikawa

Registered User.
Local time
Today, 01:50
Joined
May 17, 2007
Messages
97
Hi,

I am trying to create a .findfirst in my recordset based on the subject title of an email.

My problem starts when my subject has special character such as ', '', ", "" and MS access gives a "missing operator" error. Has anyone had this problem before and how did you work around it?

My code is :

.FindFirst ("EmailSubject = '" & oMailItem(EmailCounter).Subject & "'")
 
The only way I've found around this before is to loop through the string for each character and replace it, eg replace " with "", although you could also try replacing with StringBefore & Chr(ChrNo) & StrAfter.
 
I will try and see, does it slow down your entire computer during this process?
 
try explicitly

.FindFirst ("EmailSubject = " & chr(34) & oMailItem(EmailCounter).Subject & chr(34))

note that chr(34) is " character.
 

Users who are viewing this thread

Back
Top Bottom