Hi,
you have to either cancel delete, setting KeyCode to 0 in case of 46, or,
if you really need to delete current record, you can use AfterDelete event
to update other tables

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Using KeyPreview I am intercepting the user when he/she keys Delete
> (KeyCode
[quoted text clipped - 65 lines]
> Can anyone show me how to prevent the message from displaying in the first
> instance. TIA Simon
SimonW - 29 Sep 2006 13:05 GMT
Thanks Alex. I want the delete action to go through immediately after
DeleteSelectedItems has enumerated the selected records and UPDATEd the
table. How can I use the AfterDeleteConfirm action to update the table ?
Currently, the error message appears as soon as Access attempts to commit the
records to buffer, so I can't even get to BeforeDeleteConfirm...
The UPDATE query is setting a flag in the Products table. The table which
I'm deleting records from is the Order Details table - so there's a one to
many relationship in force...
TIA, Simon
> Hi,
> you have to either cancel delete, setting KeyCode to 0 in case of 46, or,
[quoted text clipped - 70 lines]
> > Can anyone show me how to prevent the message from displaying in the first
> > instance. TIA Simon
Alex Dybenko - 29 Sep 2006 13:49 GMT
Hi,
Just try to use AfterDeleteConfirm instead of keydown event

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Thanks Alex. I want the delete action to go through immediately after
> DeleteSelectedItems has enumerated the selected records and UPDATEd the
[quoted text clipped - 88 lines]
>> > first
>> > instance. TIA Simon
SimonW - 29 Sep 2006 16:45 GMT
Can't be done. Access commits the selected records to buffer, so I lose my
SelTop and SelHeight values. I need to perform the operation on the selected
records at the same time the user selects them for deletion - hence the
KeyPreview technique. Even tho' I free up the object with Set RS = Nothing -
somehow the table is still 'locked' and the Delete operationis halted. On the
second attempt, the code works as intended.
Can you figure out how to release the lock on the table immediately after
DeleteSelectedItems has run (it's badly named, thinking about it, I should
have called it UpdateFreeItems())
TIA, Simon
> Hi,
> Just try to use AfterDeleteConfirm instead of keydown event
[quoted text clipped - 91 lines]
> >> > first
> >> > instance. TIA Simon
Alex Dybenko - 30 Sep 2006 07:09 GMT
Hi Simon,
in this case I store selected records in some variables, here you can use
KeyDown event

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Can't be done. Access commits the selected records to buffer, so I lose
> my
[quoted text clipped - 118 lines]
>> >> > first
>> >> > instance. TIA Simon