473,396 Members | 1,799 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,396 software developers and data experts.

Handling Apostrophes

History:

Took over development of Access project after half of app was
developed. Continued the second half using same coding style as first
developer, but improved upon code and flow, etc. Almost all of the
insertions and deletions were done as DoCMD.RunSQL strSQL.

Our current problem:

All of our prototyping for the business tool was done in with
insertions and deletions, as above, without regard to the problem
introduced by apostrophes.

Rather than rewrite code, I considered using a replace function to
intelligently replace apostrophes with accent marks (underneath tilde).
There are more complex ways of handling this problem, but most require
extensive reworking of existing code.

Any ideas?

Nov 13 '05 #1
5 4877
replace the single apostrophes with double apostrophes and you're done.

Nov 13 '05 #2
ja********@gmail.com wrote:
History:

Took over development of Access project after half of app was
developed. Continued the second half using same coding style as first
developer, but improved upon code and flow, etc. Almost all of the
insertions and deletions were done as DoCMD.RunSQL strSQL.

Our current problem:

All of our prototyping for the business tool was done in with
insertions and deletions, as above, without regard to the problem
introduced by apostrophes.

Rather than rewrite code, I considered using a replace function to
intelligently replace apostrophes with accent marks (underneath tilde).
There are more complex ways of handling this problem, but most require
extensive reworking of existing code.

Any ideas?


Do you have comments in your code? Opening a form and CTRL-Fing for '
and replacing with ~ or some other character database wide would
effectdively make your application unusable.

Are you looking for code to cycle through all modules, forms, and
reports to find something?

Why not CTRL+F for "strSQL = " database wide and fix as required and
then CTRL+F for "Docmd.RunSQL"? By the time you wrote the function you
could be done with it.

Nov 13 '05 #3
<ja********@gmail.com> wrote
Took over development of Access
project after half of app was
developed. . . . Almost all of the
insertions and deletions were done
as DoCMD.RunSQL strSQL.


Almost certainly, by sticking with the choice of unbound forms and writing
SQL manipulate data, you invested more time and energy than you needed to. I
have been in a similar position, but wasn't doing anywhere near _half_ the
application, or I would have made a strong case for revising the half
already done as well as using bound forms in the new work.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #4
Multi user app, used by people in Tokyo, Sydney, Singapore, London, and
NY. I would think that the real option would have included using
unbound forms, DAO/ADO, as well as splitting the DB, etc.

Nov 13 '05 #5
Just happened to be reading about this today. I'm not a devoloper and don't
really know if it applies to your situation, but maybe it might help.

JOhn

Public Function adhHandleQuotes(strValue As String, _
Optional strDelimiter As String = """") As String
' Fix up all instances of a quote within a string by
' breaking up the string, and inserting Chr$(34) whereever
' you find a quote within the string. This way, Jet can
' handle the string for searching.

' From Access 2000 Developer's Handbook, Volume I
' by Getz, Litwin, and Gilbert. (Sybex)
' Copyright 1999. All Rights Reserved.

'
' Solution suggested by Jurgen Welz, a diligent reader.

' In:
' strValue: Value to fix up.
' strDelimiter: (Optional) Delimiter to use.
' Out:
' Return value: the text, with delimiters fixed up.
' Requires:
'
' Example:
' adhHandleQuotes("John ""Big-Boy"" O'Neil") returns
' "John " & Chr$(34) & "Big-Boy" & Chr$(34) & " O'Neil"

Dim strInsert As String
strInsert = "Chr$(" & Asc(strDelimiter) & ")"

adhHandleQuotes = _
strDelimiter & _
Replace(strValue, strDelimiter, _
strDelimiter & " & " & strInsert & " & " & strDelimiter) & _
strDelimiter
End Function
<ja********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
History:

Took over development of Access project after half of app was
developed. Continued the second half using same coding style as first
developer, but improved upon code and flow, etc. Almost all of the
insertions and deletions were done as DoCMD.RunSQL strSQL.

Our current problem:

All of our prototyping for the business tool was done in with
insertions and deletions, as above, without regard to the problem
introduced by apostrophes.

Rather than rewrite code, I considered using a replace function to
intelligently replace apostrophes with accent marks (underneath tilde).
There are more complex ways of handling this problem, but most require
extensive reworking of existing code.

Any ideas?

Nov 13 '05 #6

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

Similar topics

8
by: Joe Van Meer | last post by:
Hi all, Been a while since I've done any asp coding, but happy to be getting back into it. My question is what is the best way (now) to handle apostrophes coming in from forms and going into...
4
by: Ken Fine | last post by:
No joy on Macromedia's boards after a few days; maybe someone can help me here. I got an excellent string handling function off of planet-source-code.com that converts text strings to proper...
4
by: Lord Merlin | last post by:
When I insert info into a DB from a form, it cuts the string off at the first apostrophe ("). How would I make it insert the data as-is, with the apostrophes? Here is the code used to insert the...
1
by: kalbee | last post by:
When we insert text into field in a table, SQL SERVER apparently replaces apostrophes with question marks -- is there a way to not have this occur? We don't have this happen with the mySQL...
2
by: Poster | last post by:
After creating an IN clause from a bunch of character strings created by a Word macro, Query Analyzer complains about a syntax error. The macro takes a column full of character strings and wraps...
3
by: James Foreman | last post by:
I've got a set of emails in a table, where sometimes they've failed to input the @ properly. Eg james.foreman'abcmail.co.uk How do I write a replace to deal with that? Also, I've got a set...
3
by: Richard Hollenbeck | last post by:
I have an email field and a command button to send email. The problem is that when the email program opens up there are apostrophes around the email address that I have to manually remove before...
4
by: Nathan | last post by:
Hi, I'm doing a database app using MS Access and OleDb adapters, and I'm having trouble with getting strings containing apostrophes in and out of the database. I read through a thread below...
4
by: Lucanos | last post by:
Hey Guys, Probably a simple question, but one I am struggling with all the same. I know that in PHP you wrap a text string in apostrophes or quotations - (examples $variable = 'this string' OR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.