It’s hard to tell whether or not you’re actually using smart quotes because the forum software will eat plain ones and force-enable smart ones unless you use the preformatted text option (aka “the code tag”).
Check that your System Settings aren’t replacing single quotes with smart quotes. Check that the TextArea settings aren’t also replacing single quotes with smart quotes. Triple check that you’ve really got a plain single-quote in there.
Other than smart quotes, it’s really kind of hard to guess from this distance without seeing the behavior happen and/or being able to reproduce it.
What Tim means is that when you type the quote into the TextArea, macOS might be changing it for a nicer looking one. This causes the SQL to fail because it isn’t the standard quote character anymore.
Here are the declares for a DesktopTextArea to disable text and character substitutions regardless of your OS settings. It’s really useful for things like SQL queries.
declare function NSClassFromString lib "Cocoa" (aClassName as CFStringRef) as Ptr
declare function documentView lib "Cocoa" selector "documentView" _
(obj_id as Ptr) as Ptr
declare sub setAutomaticQuoteSubstitutionEnabled lib "Cocoa" _
selector "setAutomaticQuoteSubstitutionEnabled:" _
(id as ptr, value as Boolean)
declare sub setAutomaticDashSubstitutionEnabled lib "Cocoa" _
selector "setAutomaticDashSubstitutionEnabled:" _
(id as ptr, value as Boolean)
declare sub setAutomaticTextReplacementEnabled lib "Cocoa" _
selector "setAutomaticTextReplacementEnabled:" _
(id as ptr, value as Boolean)
dim myTextArea as ptr = documentView(me.Handle)
setAutomaticQuoteSubstitutionEnabled(myTextArea, false)
setAutomaticDashSubstitutionEnabled(myTextArea, false)
setAutomaticTextReplacementEnabled(myTextArea, false)
@Johann_Kienbrandt Thank you so much for flagging an answer post. I just wanted to point out that @Jared_Feder 's post above will actually resolve your issue without changing System Settings or modifying the input with String.Replace
You may wish to check it out. I might also suggest changing the solution post to his, because it actively solves the problem in my opinion!