hi there i have a table which i want to copy all the records from one table to another, (many different serialno. with the same product name) and at the same time delete those existing records in the table i did the following:
but it seems that the insert query only inserts one record (it doesnt seem to move next)while all deleted query deletes all the records that are statedCode:sql3 = "SELECT * FROM Serial WHERE PurchaseInvNo = '"&RS("PurchaseInvNo")&"'" Set RS4 = objConn.Execute(sql3) While NOT RS4.EOF Dim insertQuery insertQuery = "INSERT INTO PurgedSerial VALUES "&_ "('"&RS4("SerialNo")&"', '"&RS4("PartNo")&"', '"&RS4("SalesInvNo")&"', '"&RS4("PurchaseInvNo")&"');" objConn.Execute(insertQuery) Dim deleteSQL3 deleteSQL3 = "Delete From Serial Where PurchaseInvNo='"&RS4("PurchaseInvNo")&"'" 'Response.Write(deleteSQL) objConn.Execute(deleteSQL3) RS4.MoveNext Wend





Bookmarks