?
Solved

500 points - SQL Help...

Posted on 2007-11-30
4
Medium Priority
?
148 Views
Last Modified: 2010-03-20
0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 80 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

801 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