Dlookup on strings that contain an apostrophe (') or a quote (") results in an error!
eg
strCtriteria = "Apple"
ProductId = dlookup("ProductId","tblProduct","Product = '" & strCtriteria & "'") works
but if
strCtriteria = "Apple's"
ProductId = dlookup("ProductId","tblProduct","Product = '" & strCtriteria & "'") fails - syntax error (missing operator) in query expression......
Is it only apostrophe (') and quote (") that I need worry about?
I never know the position of the apostrophe (') or quote (") in the string!
How do I handle strings that may contain an apostrophe (') or a quote (")?
Thanks in advance
eg
strCtriteria = "Apple"
ProductId = dlookup("ProductId","tblProduct","Product = '" & strCtriteria & "'") works
but if
strCtriteria = "Apple's"
ProductId = dlookup("ProductId","tblProduct","Product = '" & strCtriteria & "'") fails - syntax error (missing operator) in query expression......
Is it only apostrophe (') and quote (") that I need worry about?
I never know the position of the apostrophe (') or quote (") in the string!
How do I handle strings that may contain an apostrophe (') or a quote (")?
Thanks in advance