Full Version: Another Delete problem: primary records not deleting.
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Nyteshade
I have a form that uses a query as it's recordsource to display data from two primary tables and one relation table. I created a delete command button using the button wizard. When I click delete it only deletes the record from the relation table 'tblLeasedUnit' and not from either primary table. The delete button will not allow me to execute a query based on more than one table.

I created two separate delete querys linked them to the delete command button. But, when my form initially opens it locks the record according to the recordsource and my custom querys are not allowed to delete it. So I tried putting 'me.recordlocks = false' in my code before my 'docmd.openquery' statements (which I thought may not be a good idea) but it doesn't appear to unlock the record for delete either. Any suggestions? Thx all!

tblUnit
Unit (PK)
UnitID

tblLeasedUnit
LeasedUnitPK (PK)
Lease (FK)
Unit (FK)

tblLease
Lease (PK)
schroep
You could try:

If Me.Dirty Then Me.Dirty=False

Before running your queries.

If that doesn't work, we'll need to figure out WHY they are keeping things locked. Could be the properties for your app, your form, or your query is using pessimistic locking or something along those lines.
Nyteshade
Dang if that didn't work! I did try 'me.dirty = true' before your suggestion but that didn't work so I gave up on it. Anyway, thanks, I guess I need to think about enclosing those two queries in a 'transaction' in case one of them fails?
schroep
Either do that or check for errors upon completion of each.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.