.findfirst searchtext problem (1 Viewer)

Nishikawa

Registered User.
Local time
Yesterday, 22:38
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 & "'")
 

Kafrin

Database Designer
Local time
Today, 06:38
Joined
Feb 17, 2009
Messages
149
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.
 

Nishikawa

Registered User.
Local time
Yesterday, 22:38
Joined
May 17, 2007
Messages
97
I will try and see, does it slow down your entire computer during this process?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:38
Joined
Sep 12, 2006
Messages
15,738
try explicitly

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

note that chr(34) is " character.
 

Users who are viewing this thread

Top Bottom