473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

SQL with special characters...

Hi Gurus

What if you want to run SQL and you have a blob of text that you want to add
to a field and you have no idea how many "" or ' other characters are in
the text. Is there anyway you can run the sql (docmd.runsql) without
getting in trouble???

Right now, I open a hidden form, put the text in a control and then include
something like

forms!hiddenfrm!ctl

to identify the text.

TIA
-Nicolaas
Nov 13 '05 #1
3 4631
On Tue, 29 Jun 2004 11:27:17 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

Write a function to replace funny characters by whatever the syntax
requires. E.g.
sql = "select * from tblContacts where LastName = '" &
ReplaceSubstring(forms!hiddenfrm!ctl, "'", "''") & "'"

This would replace ' with two of them, so a search for O'Brien would
be successful. Until database engines become more powerful, you have
to do the dirty work.

-Tom.
Hi Gurus

What if you want to run SQL and you have a blob of text that you want to add
to a field and you have no idea how many "" or ' other characters are in
the text. Is there anyway you can run the sql (docmd.runsql) without
getting in trouble???

Right now, I open a hidden form, put the text in a control and then include
something like

forms!hiddenfrm!ctl

to identify the text.

TIA
-Nicolaas


Nov 13 '05 #2
Tom van Stiphout wrote:
On Tue, 29 Jun 2004 11:27:17 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

Write a function to replace funny characters by whatever the syntax
requires. E.g.
sql = "select * from tblContacts where LastName = '" &
ReplaceSubstring(forms!hiddenfrm!ctl, "'", "''") & "'"


Thereby skipping over the built-in Replace() function, hmmmm :-)

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 13 '05 #3
That just seems really clumsy.

In my application, I use 100s of SQL statements and you never really know
what sort of characters you are going to encounter and how their behaviour
will be.

Thank you for your answer though.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
3
by: Barry Olly | last post by:
Hi, I'm working on a mini content management system and need help with dealing with special characters. The input are taken from html form which are then stored into a varchar column in...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
17
by: Carl Mercier | last post by:
Hi, Is it possible to use special characters like \n or \t in a VB.NET string, just like in C#? My guess is NO, but maybe there's something I don't know. If it's not possible, does anybody...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
5
by: Doc | last post by:
Hello! I'm experiencing a little problem counting the number of characters in a textarea on a html page. This is the content type of my HTML document content="text/html; charset=iso-8859-1" ...
1
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
7
by: Trac Bannon | last post by:
When I load XML from a file into a dotNet XMLDataDocument, the UTF-8 codes are resolved but the 5 special XML entities are not. How can I force those 5 special character types to be translated?
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
by: AAaron123 | last post by:
Been playing with asp:changepassword and have it looking OK except that I can't elininate or change the title at the top that says "Change Your Password". It's a repeat of my pages title. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.