operation not allowed when object is closed
-
uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, UnitPrice, FullPrice) Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & "," & iPrice & ", " & iFullPrice & ")" Set RS = Conn.Execute(uSQL) 'MsgBox ("Adding record to the datagrid") 'refreshing the datagrid based on new info RS.Requery Me.Adodc3.Refresh Me.DataGrid2.Refresh the above is code for adding data to a datagrid. the Adodc3's recordset is the table OrderDetails2 and the datasource of the datagrid is Adodc3. However, when executed, it throws the above error - i have run the code many times before and it has never thrown this error. what is the problem? if it is referring to the RS, how do i open this to stop the error occurring?
-
uSQL = "Insert Into OrderDetails2 (OrderNumber, ProductCode, ProductDesc, Quantity, UnitPrice, FullPrice) Values (" & iOrderNo & ", '" & strCode & "', '" & strDesc & "', " & iQuantity & "," & iPrice & ", " & iFullPrice & ")" Set RS = Conn.Execute(uSQL) 'MsgBox ("Adding record to the datagrid") 'refreshing the datagrid based on new info RS.Requery Me.Adodc3.Refresh Me.DataGrid2.Refresh the above is code for adding data to a datagrid. the Adodc3's recordset is the table OrderDetails2 and the datasource of the datagrid is Adodc3. However, when executed, it throws the above error - i have run the code many times before and it has never thrown this error. what is the problem? if it is referring to the RS, how do i open this to stop the error occurring?
this mat be the problem
Set RS = Conn.Execute(uSQL)
you need to callConn.Open