title: VBSCript - Access - Clean Text Escape Regex
body: <p>Am using a vbscript file. -> .vbs extension file.
  To insert pieces of text into the access database.</p>
  
  <p>Basically need to be able to put whatever characters are possible to be inserted , without throwing much issues.</p>
  
  <p>Using This :</p>
  
  <pre><code>Function CleanUp (input)
       Dim objRegExp, outputStr
       Set objRegExp = New Regexp
       objRegExp.IgnoreCase = True
       objRegExp.Global = True
       objRegExp.Pattern = "[^\w+]"
       outputStr = objRegExp.Replace(input, " ")
       CleanUp = outputStr
  End Function
  </code></pre>
  
  <p>But missing out a lot of special characters , just want be able to have the most commonly used characters like brackets , percentage , dot , comma etc inserted safely.</p>
  
  <p>Can you suggest a better Regex.</p>
  
  <p>Help with Parameter Query :
  I am using a .vbs file to perform my insert , basically a script file which I execute on my system to populate text files into access .mdb file.</p>
  
  <pre><code>Dim objConn,objRS,strSQL,rsins
  Set objConn = CreateObject("ADODB.Connection")
  Set objRS = CreateObject("ADODB.Recordset")
  filenpath = "D:\MDBFILES\"
  filenname =  "test.mdb"
  objConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&amp; filenpath &amp; filenname) 
  
  strSQL = "insert into [mytable] (F1,F2,F3Date,F4,F5Integer,F6Double) values 
  ('"     &amp;  rdoc  &amp;  "','" &amp;  rtype   &amp; "','" &amp;  CDate(rdate) &amp;  "','"  &amp;      
  CleanUp(Trim(arrCells(0))) &amp;  "','"  &amp;  CDbl(arrCells(1)) &amp;  "','"  &amp;    
  CDbl(Trim(arrCells(2))) &amp;  "')" 
  
  set rsins = objConn.Execute(strSQL) 
  </code></pre>
  
  <p>This works perfectly for me. The insert statement is within a loop , where the values are updated continuously. 
  Please advise how to create a parameter query and set the parameters with each execution.</p>
  
  <p>Thanks.</p>