Problem building string

Access Virgin

Registered User.
Local time
Today, 19:06
Joined
Apr 8, 2003
Messages
77
I have a multi select list box that allows the user to run a report for more than one person. I have used a SQL statement to achieve this. It works fine until the person has an ' in their name, ie O'Neill, then an error occurs because the code thinks that this is part of the code. Part of my code on the multi select list box click event is:

listvalues = listvalues & "(((Table1.UserName)='" & Me.UserNameList.Column(0, I) & "')) OR "

Is their anyway around this so names such as O'Neill can be accepted????
 
Last edited:
You can replace the ' delimiter with ""

Code:
Table1.UserName = """ & Me.UserNameList.Column(0, I) & """ OR "
 

Users who are viewing this thread

Back
Top Bottom