Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, I've been playing around with connecting to a database and inserting
information using the following code. (just pasting it in sorry if it looks messy) Sub ADOTest() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim strSQL As String Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=C:\temp\testdb\test.mdb;" cn.CursorLocation = adUseClient strSQL = "INSERT INTO tblPeople ([fldName], [fldAge]) VALUES('A Test', '24');" rs.Open strSQL, cn rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub I get the following error on the line that says "rs.Close" "Operation is not allowed when the object is closed. " It was to my understanding that I had to close everything, it inserts the test data and continue to works if i comment out that line, but I'd like to know why it isn't working. Thanks for any help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Large Operation Error | Excel Discussion (Misc queries) | |||
Operation is not allowed | Excel Programming | |||
No more fonts allowed for this file error mesage | Charts and Charting in Excel | |||
"operation is not allowed when the object is closed" error when us | Excel Programming | |||
Operation Is Not Allowed When The Object Is Closed | Excel Programming |