Am using a vbscript file. -> .vbs extension file. To insert pieces of text into the access database.
Basically need to be able to put whatever characters are possible to be inserted , without throwing much issues.
Using This :
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
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.
Can you suggest a better Regex.
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.
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="& filenpath & filenname)
strSQL = "insert into [mytable] (F1,F2,F3Date,F4,F5Integer,F6Double) values
('" & rdoc & "','" & rtype & "','" & CDate(rdate) & "','" &
CleanUp(Trim(arrCells(0))) & "','" & CDbl(arrCells(1)) & "','" &
CDbl(Trim(arrCells(2))) & "')"
set rsins = objConn.Execute(strSQL)
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.
Thanks.