GHarmon1977
Technical User
I'm attempting to add an attachment to a MS Access 2010 database via VBScript. But, I do not know the proper syntax for the command, nor can I find it.
.vbs file name: ms.vbs stored on C:from DOS: cscript /nologo C:\ms.vbs
Problem Line: nRS.Fields("Attachments").Value = "C:\ms.txt"
What is the proper syntax for adding an attachment?
Code:
.vbs file name: ms.vbs stored on C:from DOS: cscript /nologo C:\ms.vbs
Problem Line: nRS.Fields("Attachments").Value = "C:\ms.txt"
What is the proper syntax for adding an attachment?
Code:
Code:
Set nRS = CreateObject("ADODB.Recordset")
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\CR.accdb;"
sql = "Select * from tbl_ChangeRequests order by ChangeRequestID desc"
set cn = createobject("ADODB.Connection")
cn.open connectionString
Set RS = cn.Execute(sql)
NCN = RS("ChangeRequestID") + 1
WScript.Echo NCN
RS.Close
Set RS = Nothing
nRS.Open "tbl_ChangeRequests", cn, 2, 3
nRS.AddNew
nRS.Fields("ChangeRequestID").Value = NCN
nRS.Fields("Author").Value = "Me"
nRS.Fields("SignOff_Status").Value = "0"
nRS.Fields("Attachments").Value = "C:\ms.txt"
nRS.Update
nRS.Close
Set nRS = Nothing
cn.Close
Set cn = nothing