Remove Single Quote

P

PeterM

I have a listbox on a AC2003 form. I want to perform the following DLookup
based on one of the columns/row in the single select listbox. I works great
until the target table column contains a single quote. How do I resolve this
situation?

DLookup("Contents", "OutlookInbox", "Subject = '" & Me.List28.Column(2) &
"'")

Thanks for your help!
 
F

fredg

I have a listbox on a AC2003 form. I want to perform the following DLookup
based on one of the columns/row in the single select listbox. I works great
until the target table column contains a single quote. How do I resolve this
situation?

DLookup("Contents", "OutlookInbox", "Subject = '" & Me.List28.Column(2) &
"'")

Thanks for your help!

Here is one method:
= DLookup("Contents", "OutlookInbox", "Subject = """ &
Me.List28.Column(2) & """")
 
D

Duane Hookom

Replace the single quote with two double quotes:
DLookup("Contents", "OutlookInbox", "Subject = """ & Me.List28.Column(2) &
"""")
 
D

David Kaye

I have a listbox on a AC2003 form. I want to perform the following DLookup
based on one of the columns/row in the single select listbox. I works great
until the target table column contains a single quote. How do I resolve this
situation?

I got so tired of escaping the single quote character that I just replace it
with the alternate apostrophe, CHR$(146). I trap keystrokes and substitute
the 146 character in the original data entry and I also run a REPLACE function
when importing data from external sources, looping through every field in
every table when importing. To me this is way easier than having to figure
out the escape for single quotes.

(If there's anything I hate about Access (and there isn't much) it's that the
stupid escape sequence. They should have used a backslash or some other rare
character. )
 
R

Risse

PeterM said:
I have a listbox on a AC2003 form. I want to perform the following DLookup
based on one of the columns/row in the single select listbox. I works
great
until the target table column contains a single quote. How do I resolve
this
situation?

DLookup("Contents", "OutlookInbox", "Subject = '" & Me.List28.Column(2) &
"'")

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Search Listbox vs Table Query 1
Info on Report 3
DLookUp 7
Dlookup Question 3
Store a list in a single cell 7
Listbox query 3
DLOOKUP question 3
Open Form based on Listbox 2

Top