MrBelfry
IS-IT--Management
- May 21, 2003
- 289
Hey there
I have an access database that sorts through some records. It uses a docmd.runsql thingy with a sql string constructed from the data in a list box so the code looks like this:
Unfortunately if the itemdata contains an apostrophe it messes up the sql. Is there anyway to still use apostrophes in the list box that won't mess up my sql. The data in the list box is someones name so it is sometimes necessary to write O'Conner for example.
Thanks in advance
MrBelfry
I have an access database that sorts through some records. It uses a docmd.runsql thingy with a sql string constructed from the data in a list box so the code looks like this:
Code:
SqlStatement = "INSERT INTO mailing (id, name, title) VALUES ('" & lstID.ItemData(i) & "', '" & lstName.ItemData(i) & "', '" & lstTitle.ItemData(i) & "') "
Unfortunately if the itemdata contains an apostrophe it messes up the sql. Is there anyway to still use apostrophes in the list box that won't mess up my sql. The data in the list box is someones name so it is sometimes necessary to write O'Conner for example.
Thanks in advance
MrBelfry