I am trying to get a conditional UPDATE SQL statement to update an Access database but, every time, it updates the second SQL statement and not the first.?
Here is the SQL statement:
strSQL7 = "SELECT * FROM tblDevices WHERE DeviceID_ID = '" & Session("DeviceName") & "'"
objARec.Open strSQL7, strConnDataData, adOpenForwardOnly, adLockOptimistic
If objARec("DeviceStatus")="Out of Service" then
strSQL2 = "UPDATE tblDevices SET DeviceStatus='Out of Service' WHERE DeviceID_ID = '" & Session("DeviceName") & "'"
objAConn.Execute strSQL2
Else
strSQL2 = "UPDATE tblDevices SET DeviceStatus='Needs-Service' WHERE DeviceID_ID = '" & Session("DeviceName") & "'"
objAConn.Execute strSQL2
end if
Any ideas? Thanks.
