J
Jeff Wilkin
using the AfterUpdate event of a checkbox control on a continuous subform,
I'm trying to delete certain records from a table which is not bound to my
form. I'm getting Runtime error 3131 stating that there is a syntax error in
the FROM clause.
--- Code ---
Private Sub chkBestellt_AfterUpdate()
Dim strSql As String
Dim dSql As String
If Me.chkBestellt = True Then
If Not IsNull(Me.Menge) Then
strSql = "Insert Into BestellDetails
(ArtikelID,Menge,VerpID,BestellungenID) " & _
"Values (" & Me.ArtikelID & ", " & Me.Menge & ", " & Me.VerpID & ",
" & Me.BestellungenID & ")"
CurrentDb.Execute strSql, dbFailOnError
End If
Else
dSql = "DELETE * FROM BestellDetails " & _
"(SELECT BestellDetails.ArtikelID, BestellDetails.BestellungenID
FROM BestellDetails " & _
"WHERE (([BestellDetails.ArtikelID]=" & Me.ArtikelID & " AND " & _
"[BestellDetails.BestellungenID]=" & Me.BestellungenID & ")));"
CurrentDb.Execute dSql, dbFailOnError
End If
End Sub
--------------
ArtikelID & BestellungenID are both long integers.
Any help is greatly appreciated.
TIA
Jeff
I'm trying to delete certain records from a table which is not bound to my
form. I'm getting Runtime error 3131 stating that there is a syntax error in
the FROM clause.
--- Code ---
Private Sub chkBestellt_AfterUpdate()
Dim strSql As String
Dim dSql As String
If Me.chkBestellt = True Then
If Not IsNull(Me.Menge) Then
strSql = "Insert Into BestellDetails
(ArtikelID,Menge,VerpID,BestellungenID) " & _
"Values (" & Me.ArtikelID & ", " & Me.Menge & ", " & Me.VerpID & ",
" & Me.BestellungenID & ")"
CurrentDb.Execute strSql, dbFailOnError
End If
Else
dSql = "DELETE * FROM BestellDetails " & _
"(SELECT BestellDetails.ArtikelID, BestellDetails.BestellungenID
FROM BestellDetails " & _
"WHERE (([BestellDetails.ArtikelID]=" & Me.ArtikelID & " AND " & _
"[BestellDetails.BestellungenID]=" & Me.BestellungenID & ")));"
CurrentDb.Execute dSql, dbFailOnError
End If
End Sub
--------------
ArtikelID & BestellungenID are both long integers.
Any help is greatly appreciated.
TIA
Jeff