IndigoDragon
Programmer
Hi there,
I would like to update a record in an external (closed) workbook through an ADO connection. So far I haven't been able to update a record. Could anyone tell me if I'm using the right properties for the connectionstring and sql string?
ThanX!
I would like to update a record in an external (closed) workbook through an ADO connection. So far I haven't been able to update a record. Could anyone tell me if I'm using the right properties for the connectionstring and sql string?
ThanX!
Code:
cn.Open "DRIVER={Microsoft Excel Driver (*.xls)};DriverId=790;ReadOnly=False;" & "DBQ=" & strSourceFile & ";"
On Error GoTo 0
If cn Is Nothing Then
MsgBox "File can not be found!", vbExclamation, ThisWorkbook.Name
Exit Sub
End If
' Save data to archive.
strSQL = "UPDATE [Mails$] SET [Read] = 'FALSE' WHERE [MailID] = '1'"
' Open the recordset.
Set rs = New ADODB.Recordset
On Error Resume Next
rs.Open strSQL, cn, adOpenDynamic, adLockOptimistic