I tried what you said and it works great! Thanks! Another solution presented by a friend said that I had to remove the html codes (the head, html, body tags, etc.) surrounding the script and then remove the new_rs.Close. It also worked however i'm in doubt about this method - removing the new_rs.Close.
What happens to that recordset? Does it get closed automatically? Should I close db_conn too?
Thanks again!
Carlos
>Perfect! Now here is an example of when you need to use the Connection object! When you use the Recordset.Open method, ADO expects to get records back from the data source. Since you are doing an Insert, there aren't any records coming back and so you get the error (although the error message doesn't really help you to know that).
>
>The way to do this is to use the Execute method of the Connection object. The code would look something like this:
>
>' Create insert statement
>new_qry = "Insert into cmts_unit_invty values('" & myvar1 & "'," & myvar2 & ")"
>
>' Create Connection object
>Set db_conn = Server.CreateObject("ADODB.Connection")
>
>' Open connection using DSN
>db_conn.Open "DSN=mydsn;UID=myid;PWD="
>
>' Send the insert statement to the back end
>db_conn.Execute new_qry
>
>HTH
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only