November 6th, 2012, 03:14 PM
Delete and Insert at same time
This code seems to work, but is this fundamentally correct or is there a better way of doing both a delete and an insert to follow:
sql_1= "Delete From Table1 Where CustomerID = "&CustomerID&" and Productid = "&Productid&" "
sql_2 = "insert into Table1 (ProductID,CustomerID,NewDate) values(" &_
"'" & NewProductID & "'," &_
"'" & CustomerID & "'," &_
"'" & NewDate & "')"
November 6th, 2012, 03:25 PM
this code should work. I'm not sure what you trying to archive, and what is your table structure, but nothing wrong with that code
if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
November 6th, 2012, 03:34 PM
My main concern is if it's ok to first DELETE (which is what I want) and then INSERT. I am basically making a substitute. Like I said, it works in trial but wasn't sure if there is a fundamentally better way of doing that.
Thanks for looking at that, I appreciate it.