G
Guest
i have been trying to do an update to a table through code so i can clear a
record that causes a form to load on a specific record. everything else works
great but when i put in this code my button breaks.
heres the code:
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
DoCmd.Close acForm, "zzMAINFORM"
If Not IsNull(DLookup("Value", "tblSys", "[Variable]=ProductIDLast")) Then
DoCmd.RunSQL "UPDATE tblSys SET tblSys.[Value] = ""1"" WHERE
(((tblSys.Variable)=""ProductIDLast""));"
End If
DoCmd.Quit
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnExit_Click
End Sub
i keep getting "you canceled the previous operation". i hope it has to do
with the quotes on the sql statement, but i am unsure of what is really
wrong. there is an unload event on zzMAINFORM and so i told this button to
close the form first, then update the record in the table, then close the
application.
i dont know where the problem is in the sql, but that is what my biggest
suspect is at the moment.
any ideas?
record that causes a form to load on a specific record. everything else works
great but when i put in this code my button breaks.
heres the code:
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
DoCmd.Close acForm, "zzMAINFORM"
If Not IsNull(DLookup("Value", "tblSys", "[Variable]=ProductIDLast")) Then
DoCmd.RunSQL "UPDATE tblSys SET tblSys.[Value] = ""1"" WHERE
(((tblSys.Variable)=""ProductIDLast""));"
End If
DoCmd.Quit
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox Err.DESCRIPTION
Resume Exit_btnExit_Click
End Sub
i keep getting "you canceled the previous operation". i hope it has to do
with the quotes on the sql statement, but i am unsure of what is really
wrong. there is an unload event on zzMAINFORM and so i told this button to
close the form first, then update the record in the table, then close the
application.
i dont know where the problem is in the sql, but that is what my biggest
suspect is at the moment.
any ideas?