Hi, I really hope you can help... I am currently trying to write a code that will take an excel spreadsheet & save it to an access Table.
I come up with an error "Operation is not allowed when the object is closed." after the insert statement has run.
I am really sorry if this sounds really vague, but I am only new to programming.
Thank you for your assistance
AK
I come up with an error "Operation is not allowed when the object is closed." after the insert statement has run.
Code:
Sub AccessLoading() Dim cn As ADODB.Connection, rs As ADODB.Recordset, intColIndex As Integer Set cn = New ADODB.Connection Set rs = New ADODB.Recordset DBFullName = "G:\Agent Support Centre\Envelopes\MASTER DATA\PROCESS MANAGER\BACK\Process Manager 2006_be.mdb" cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ DBFullName & ";" Dim updatesql As String updatesql = "INSERT INTO Tbl_PartnerNETPayments ( Plant ) VALUES ('" & Range("A1").Value & "');" rs.Open updatesql, cn, adOpenDynamic, adLockOptimistic rs.AddNew rs.Update rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub
I am really sorry if this sounds really vague, but I am only new to programming.
Thank you for your assistance
AK
Comment