Reputation: 11
here's the code
Public Sub DeleteRoom(Room_ID As String)
Dim CNo As Object
Set CNo = SQLDNSCONNECT("TEST")
Dim RSo As Recordset
Set RSo = New Recordset
Dim msql As String
With CNo
.Open
If RSo.State = adStateOpen Then RSo.Close
msql = "DELETE * FROM Room WHERE Room_ID='" & Room_ID & "'"
RSo.Open msql, CNo
MsgBox "Record(s) Deleted", vbInformation, ""
End With
End Sub
The error is the "RSo.State = adStateOpen Then RSo.close"
I don't know why but it really seems right.
Can someone help me?
Upvotes: 0
Views: 544
Reputation: 146350
The DELETE
clause does not accept columns:
Just remove the *
:
DELETE FROM Room WHERE Room_ID=...
Upvotes: 2