UPDATE QUERY

sbaud2003

Member
Local time
Today, 18:33
Joined
Apr 5, 2020
Messages
184
My qudate query is not running showing error : key violation. Although when i tries to run the query directly is doesnot show any error and it is updating the records. But when i am trying to run it from the form, due to LOCK violation table not updated.

my SQL is

UPDATE MEMBERS SET MEMBERS.EL = [EL]-[FORMS]![LEAVE_UPDATE]![TXTNOD]
WHERE (((MEMBERS.ACCOUNT_NO)=[FORMS]![LEAVE_UPDATE]![TXTAC]) AND (([FORMS]![LEAVE_UPDATE]![LEAVE_TYPE])="EL"));
 
Last edited:
How exactly are you trying to run the query from a form? Can you show us your code?
 
How exactly are you trying to run the query from a form? Can you show us your code?
I am using a command button and in the click event i have the followind code:

DoCmd.SetWarnings False
DoCmd.OpenQuery "QUPDATE_ELR"
DoCmd.SetWarnings True


QUPDATE_ELR is the query SQL is
UPDATE MEMBERS SET MEMBERS.EL = [EL]-[FORMS]![LEAVE_UPDATE]![TXTNOD]
WHERE (((MEMBERS.ACCOUNT_NO)=[FORMS]![LEAVE_UPDATE]![TXTAC]) AND (([FORMS]![LEAVE_UPDATE]![LEAVE_TYPE])="EL"));
 
Is your form bound to the Members table? If so, try saving any recod changes first before running the query.
 
Also, make sure the default lock setting is "no Locks"
1696979614529.png
 

Users who are viewing this thread

Back
Top Bottom