title: SQL Updates/Inserts with data with double quotes
body: <p>I have a database that collects client information using assessments and other tools. Often in the assessments there are double quotes in the data when - as may be expected - a direct quote is captured. When I run sql updates (Access front end using VBA to SQL Server 2008 R2 backend) it blows up on double quotes in the data. In the interim I've asked staff to use single quotes when they enter data, but that is an unsustainable solution as they forget and the program crashes when it hits the double quotes. The datatype is nvarchar(max). </p>
  
  <p>The current VBA string looks like this:</p>
  
  <blockquote>
    <p>strInsertSQL = "INSERT INTO tblIRPDetail(IRPID, SectionID, Challenge, Goal, Objective, Intervention, IntDate) VALUES(" &amp; intNewID &amp; ", " &amp; intSection &amp; ", """ &amp; strChallenge &amp; """, """ &amp; strGoal &amp; """, """ &amp; strObjective &amp; """, """ &amp; strIntervention &amp; """, """ &amp; strIntDate &amp; """);"</p>
  </blockquote>
  
  <p>Essentially any of the strVariables could have single or double quotes in any combination. It works for single quotes but not doubles. Surely this is a fairly common issue, I'm hoping someone has a simple solution!</p>
  
  <p>Thanks in advance!</p>