Dillinger4
Oct 13th, 2000, 09:09 AM
Does anyone know if it is possible to delete records
from a record set opened with an SQL string? If i
run this code it produces a runtime error:
(3027 cannot update database or object is read only)
but if i replace the SQL string with an actual table
name the deletions take place and everything is fine.
Private Sub cmdDelete_Click()
Dim responce As String
Dim strSql As String
Set db = OpenDatabase(KeySetting)
strSQL = strSql = "SELECT [Account Information].*, [Route Details].*, [Ticket Information].* FROM ([Account Information] INNER JOIN [Route Details] ON [Account Information].AccountID = [Route Details].AccountID) INNER JOIN [Ticket Information] ON ([Route Details].AccountID = [Ticket Information].AccountID) AND ([Account Information].AccountID = [Ticket Information].AccountID);"
' keysetting is just a public variable that contains the
' path from the GetSetting function.
Set rs = db.OpenRecordset(strSql)
responce = MsgBox("Are you sure that this record is to be deleted?", vbYesNo + vbQuestion)
If responce = vbYes Then
rs.Delete
End If
rs.Close
End Sub
' I wanted to use cascading updates and deletes to make things easier but then i would have to force refrential integrity, which was causing an error.
Thanks All........
from a record set opened with an SQL string? If i
run this code it produces a runtime error:
(3027 cannot update database or object is read only)
but if i replace the SQL string with an actual table
name the deletions take place and everything is fine.
Private Sub cmdDelete_Click()
Dim responce As String
Dim strSql As String
Set db = OpenDatabase(KeySetting)
strSQL = strSql = "SELECT [Account Information].*, [Route Details].*, [Ticket Information].* FROM ([Account Information] INNER JOIN [Route Details] ON [Account Information].AccountID = [Route Details].AccountID) INNER JOIN [Ticket Information] ON ([Route Details].AccountID = [Ticket Information].AccountID) AND ([Account Information].AccountID = [Ticket Information].AccountID);"
' keysetting is just a public variable that contains the
' path from the GetSetting function.
Set rs = db.OpenRecordset(strSql)
responce = MsgBox("Are you sure that this record is to be deleted?", vbYesNo + vbQuestion)
If responce = vbYes Then
rs.Delete
End If
rs.Close
End Sub
' I wanted to use cascading updates and deletes to make things easier but then i would have to force refrential integrity, which was causing an error.
Thanks All........