My Assistant
![]() ![]() |
|
|
Nov 4 2007, 12:31 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 1,289 From: Ohio, USA |
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) |
|
|
|
Nov 4 2007, 12:39 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 5,200 From: Denver, Colorado [USA] |
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. |
|
|
|
Nov 4 2007, 02:35 PM
Post
#3
|
|
|
UtterAccess Ruler Posts: 1,289 From: Ohio, USA |
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?
|
|
|
|
Nov 4 2007, 06:47 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 5,200 From: Denver, Colorado [USA] |
Either do that or check for errors upon completion of each.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 09:40 AM |