Hello,
I am new to the forum and an extreme newbie when it comes to using code to manipulate a database, so please be patient!
I am trying to delete records from an Access database, but only records that have 3 specific columns that are identical. For instance, if the Date column has today's date, and the Reason column has a particular value (string), and the Response column has a particular value (string), then and only then should those records be deleted. Here is my weak attempt at accomplishing this:
'Delete all records matching criteria
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oConn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}"
oConn.connectionstring = oConn.connectionstring & "; DBQ=" & DSNname
oConn.Open<br>
SQLstr = "DELETE * FROM Arata_pressure_test_data WHERE Date = Date() AND [Who is at fault] = Request("AtFault") AND [Reject reason] = Request("RejReason")"
oRS.Open SQLstr, oConn, 2, 3
Like I said, I'm a newbie...Thanks for all your help!
I am new to the forum and an extreme newbie when it comes to using code to manipulate a database, so please be patient!
I am trying to delete records from an Access database, but only records that have 3 specific columns that are identical. For instance, if the Date column has today's date, and the Reason column has a particular value (string), and the Response column has a particular value (string), then and only then should those records be deleted. Here is my weak attempt at accomplishing this:
'Delete all records matching criteria
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oConn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}"
oConn.connectionstring = oConn.connectionstring & "; DBQ=" & DSNname
oConn.Open<br>
SQLstr = "DELETE * FROM Arata_pressure_test_data WHERE Date = Date() AND [Who is at fault] = Request("AtFault") AND [Reject reason] = Request("RejReason")"
oRS.Open SQLstr, oConn, 2, 3
Like I said, I'm a newbie...Thanks for all your help!