On Mon, 18 Oct 2010 22:39:01 -0400, "LAS" <(E-Mail Removed)> wrote:
>I have a function, listed below. When I run it, gs_sql is equal to this
>(cut from the debugger's view immediate window):
>
>"Delete from tblStudentTracking where student_id = 384 and incident_date =
>#10/18/2010# and Incident_Sequence =3"
>
>When I execute the function, no error is registered. But neither is the row
>deleted. When I paste the same statement in a Delete query, it deletes the
>row fine. What could be wrong?
>
>TIA
You might be getting an error and not seeing it. Try using the dbFailOnError
argument to trap query errors:
Private Sub cmdDelete_Click()
On Error GoTo Delete_Err
gs_sql = "Delete from tblStudentTracking where student_id = " &
Me!Student_ID _
& " and incident_date = #" & Me!Incident_date _
& "# and Incident_Sequence =" & Me!Incident_Sequence
Call CurrentDb.Execute gs_sql, dbFailOnError
Delete_Exit:
Exit Sub
Delete_Err:
MsgBox Error$
Resume Delete_Exit
End Sub
This will transfer control to the Delete_Err code if there's any error in the
query.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also
http://www.utteraccess.com