Solved

500 points - SQL Help...

Posted on 2007-11-30
4
146 Views
Last Modified: 2010-03-20
0
Comment
Question by:Mike Eghtebas
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Rick_Rickards
ID: 20383994
Are you sure that none of your string values inserted in your query are free of an apostrophe?  It would only take one to make everything crash....

Replace(fieldValue,"'","''")

When compiling your SQL string any string values with the character --> '  
must be doubled up -->  ''   <-- two apostrophizes
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 20384221
Hi Rick_Rickards,

As it is stated in the original question, the submitted SQL works just fine without Where clause. So, all those Replace(fieldValue,"'","''")  etc. are fine.

Mike
0
 
LVL 16

Accepted Solution

by:
Rick_Rickards earned 20 total points
ID: 20384274
If the code snippet below does not work below can you run the following code....

Debug.print " Where ((tEmails.SentOn <> #" & .SentOn & "#) and (tEmails.SenderInitials <> '" & strInitials & "'));"

and then post what it says.  The answer is no doubt in there.
" Where ((tEmails.SentOn <> #" & CDate(.SentOn) & "#) and (tEmails.SenderInitials <> '" & Replace(strInitials,"'","''") & "'));"

Open in new window

0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 20437923
Forced accept.

modus_operandi
EE Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need return values from a stored procedure 8 46
SQL to JSON 14 41
Get data from two MySQL tables 6 30
How to trim a value in SQL 2 28
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question