I have been searched the web extensively and been unable to find an answer to my problem, so any help would be greatly appreciated.
I have built an Access form which allows a user delete all records based on a selected group ID and date. The Group ID and Date are selected from multiple select list boxes which have the following row source:
Code:
SELECT ID_Group, Group_Name FROM tbl_Group_List;
and
Code:
SELECT DISTINCT et.report_date FROM qry_existing_reports AS et WHERE (((InStr(get_global("GBL_delete_selected_groups"),[et.ID_Group]))>0));
(The selected listbox items are stored in a global variable and using this WHERE InStr() Syntax I am able to simulate the IN functionality of MySQL)
after the user has chosen the combination of groups and dates they would like to remove the following query is run from an onClick event:
Code:
DELETE m.*
FROM tbl_monthly_reports AS m
INNER JOIN tbl_group_info AS g
ON m.loan_ID=g.loan_ID
WHERE (((InStr(get_global("GBL_delete_selected_groups"),g.ID_Trade))>0)) And (((InStr(get_global("GBL_delete_selected_dates"),Cstr(m.group_date)))>0));
In most cases everything works as I designed and the records the user has chosen are removed. However some of the time (maybe 10% of the time), a few records from the group will not delete (less than 5 out of hundreds).
Access displays a message saying that the records were not deleted due to lock violations. To try to correct for this I double checked that Default record locking was set to No Locks/Exclusive/Unchecked record level locking. I also added Timestamp fields and re-linked the tables. When I try to view the tables in Access after performing the query I see #DELETED# in all fields which should have been deleted, but if I run a select query from MySQL I can still see the records. How can I ensure that this query runs every time and these remaining records are deleted as they should be?
Thank you!