View Full Version : Solution - Problems when deleting a row


scrub55434
07-08-2005, 01:58 PM
Link to the original thread (http://www.access-programmers.co.uk/forums/showthread.php?t=89557)

I have realized what I was doing wrong and thought that I would post the solution in case anyone else does the same trying to implement security. First off thanks Pat Hartman for the input. You were right on there needing to be a cutoff and now one is added that ensures they can't edit punches after payroll has started.

I had the right idea with the many to many relationship to get a list of buildings. What I was doing wrong was joining the resulting table to the shifts table. Instead the correct way (well, it works anyways) is include WHERE Building IN (SELECT ....) in the sql where the select statement gets the list of buildings numbers that I have access to.

Now the list is limited to the buildings that they have access to and when you delete only the shift table is affected because none of the other tables are joined.

Pat Hartman
07-11-2005, 07:04 PM
In a delete query that joins two tables, only the child records are deleted. So for example, if you join Order and OrderDetails in a delete query, only the OrderDetails records will be deleted. If you want to delete the Order, do not include the OrderDetails table in the query. Cascade delete will take care of deleting the related OrderDetails records.