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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3077 1

Status
Not open for further replies.

fileman1

Technical User
Feb 7, 2013
152
GB
I have a string variable LKS

If it contains the character ' eg It's, then the following line crashes, causing error 3077

' Is the word a keyword?
rs6.FindFirst "Keyword ='" & LKS & " '"

How can I stop this and any other character causing an error? Thanks
 
it'll be the apostrophe try:
Code:
replace(LKS,"'","''")

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Thanks, but I tried:

rs6.FindFirst "Keyword = replace(LKS," '","''")

rs6.FindFirst "Keyword =(LKS," '","''")

rs6.FindFirst "Keyword = LKS," '","''
 
Code:
rs6.FindFirst "Keyword='" & Replace(LKS, "'", "''") & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you PHV, that fixed it. The code failed also further down the line, but with that syntax managed to sort all.

I just hope other characters entered as text don't make things fall over again, it was only because I used the character in a word that the fault appeared.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top