Paul Hartland (ISHARP)
paul.hartland at isharp.co.uk
Thu Jul 28 10:38:34 CDT 2005
Julie, I think I used to do something like the following: Dim strSQL As String Dim strName as string If InStr([Field],"'")>0 ) then strName = strSQL = "SELECT [Fields] FROM [Table] WHERE Left([Field],InStr([Field],"'")-1) & Mid([Field],InStr([Field],"'")+1) = '" & strName & "'" Else strSQL = "SELECT [Fields] FROM [Table] WHERE [Field] = '" & strName & "'" Endif Written off top of my head, so may need modifying Paul -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Julie Reardon-Taylor Sent: 28 July 2005 16:23 To: accessd at databaseadvisors.com Subject: [AccessD] strip the apostrophe's Hi, I'm using a sql statement behind a search box to return the member's name as a result of a search with the data being displayed by the user choosing a query (button) or a report (button). All was well until I ran into the data below: Joe's Electrical My sql statement errors out because it cannot handle the extra apostrophe. Should I be stripping any extra syntax before I process the sql statement, or should I test for this condition and handle this in a separate routine? Julie Reardon-Taylor PRO-SOFT OF NY, INC. 44 Public Square Suite #5 Watertown, NY 13601 Phone/Fax: (315) 785-0319 www.pro-soft.net -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com