Rabu, 12 April 2017

Re: [MS_AccessPros] Apostrophe in Variable

 

Dear paco6945- (name?)


Try this:

SELECT Part FROM tblPart INNER JOIN tblPartSupplier ON tblPart.Part = tblPartSupplier.Part WHERE (((tblPartSupplier.Supplier)= """ & varSupplier & """" & ")"

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Apr 12, 2017, at 11:01 PM, paco6945@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I'm having a problem with the syntax for passing a variable whose definition contains an apostrophe to a SQL statement. I can never seem to get the punctuation right.


This doesn't work what I tried passing the name WITH the variable in code:

SELECT Part FROM tblPart INNER JOIN tblPartSupplier ON tblPart.Part = tblPartSupplier.Part WHERE (((tblPartSupplier.Supplier)= '" & varSupplier & "'" & ")"


It translates to:


SELECT Part FROM tblPart INNER JOIN tblPartSupplier ON tblPart.Part = tblPartSupplier.Part WHERE (((tblPartSupplier.Supplier)= 'Plumber's Supply')


What I need to end up with is double quotes around the supplier name: ("Plumber's Supply")



Can anyone point me in the right direction?





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar