Wrox Programmer Forums
|
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
 
Old December 20th, 2004, 01:46 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Punctuation in SQL Strings

Does any one know if it is possible to have SQL strings to access data, where the data in question might contain both a " and a '?

I have been using chr(34) but that doesn't work when there is a " in the data itself. For instance, I wanted an INSERT query that would insert 3015 "J" Street into the Address table.

Any help or suggestions would be appreciated.

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old December 20th, 2004, 03:23 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Why do you need quotes around the J in "J" Street? Put those in your report formatting later.

In Access, I use "'" to pass single quotes in SQL criteria, like this:

stValue = "MyValue"
stLinkCriteria = "[FieldName] = " & "'" & stValue & "'"

It is passed to look like this:

[FieldName] = 'MyValue'

I hope this gets you started.


mmcdonal
 
Old December 20th, 2004, 04:21 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks. The problem is that I am working with about 18000 records which have been entered in by end users over the past 15 years. I guess that just felt that they should put the odd ' and " in to make my job more interesting.

I had been using "'" to get the quotes in, but then got hung up on O'Brien and so I have started using chr(34) instead. Do you know if there are escape sequences that can be used in VBA, like Java and C++? If not, I may have to parse the data before moving it into a different table.

Thanks

Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
strings bschleusner C# 2005 3 February 27th, 2007 11:46 PM
Strings ldoodle Classic ASP Basics 0 June 28th, 2005 09:26 AM
strings Moharo Pro PHP 2 May 17th, 2004 06:15 AM
strings... slowhand BOOK: ASP.NET Website Programming Problem-Design-Solution 1 January 5th, 2004 06:27 AM
strings slowhand SQL Server 2000 1 January 5th, 2004 12:20 AM





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