Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 19th, 2005, 01:51 PM
Authorized User
 
Join Date: Sep 2004
Location: Twickenham, , United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Paulsh Send a message via Yahoo to Paulsh
Default special characters in search criteria

I have some instances where I need to search for a particular value that has a special character in it. For example:
.findfirst AthleteName = "Rob O'Connell"

This returns an error. invalid syntax.

If I try to put square brackets [] around the field I get a different error - field name not valid

The following is the actual syntax used:-

rs.FindFirst "[AthleteName] = '" & Me![cboAthleteName] & "'"

Thanks for your help.

Paul
__________________
Paul
  #2 (permalink)  
Old September 19th, 2005, 11:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This should fix your problem
rs.FindFirst "[AthleteName] = '" & Replace(Me.cboAthleteName, "'", "''") & "'"



I am a loud man with a very large hat. This means I am in charge


Similar Threads
Thread Thread Starter Forum Replies Last Post
querystring and special characters tulincim Classic ASP Basics 4 October 4th, 2005 06:05 PM
storing special special characters in nvarchar... ACE2084 SQL Server 2000 2 February 9th, 2005 11:45 AM
Substring and special characters geordaa XSLT 4 September 24th, 2004 02:27 AM
special characters lian_a Classic ASP Basics 3 June 23rd, 2004 05:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.