Could not update, currently locked by another session on this mach

D

D Riggins

I have a form with a subform and whenever I try to delete a record in the
main form, I get the error "Could not update, currently locked by another
session on this machine". This occurs several times then the record is
finally deleted. Since I know I am othe only one in the DB and there is only
one session going, the error makes no sense.

The records in the subform are in tables that are related to the main form
records with a one-to-one relationship on the primary keys (with referential
integrity enforced and cascade update and delete enabled). The subform
records do not include the table that the main form uses as a datasoruce.

The same thing happens in both Access 2003 and 2007.

Can anyone tell me what the error really means?
 
N

NKTower

By any chance is the table a SQL Server table rather than native Access? And
if so, do you have any bit fields linked to a checkbox on the form? This
would happen if the original Access form had a Y/N field. If so, SQL Server
has the ability to have a bit field have a NULL value in addition to the 1
and 0 for True/False, and Access has a problem with that - you get the
somewhat misleading (ahem) error message that your report. The cure is to
make sure that all bit-fields do not allow NULL, and have an appropriate
default value in the SQL Server definition. If you used the upsizeing
wizard, it did NOT do this for you. You will also have to run a query to set
the fields that are NULL to 0, as that won't happen for existing records when
you change the definition in SQL Server.

A dead give-away that this is the case is that the checkbox will be 'grayed'
if it is bound to a NULL value in SQL Server, where it will be clear (white)
for a true FALSE and have the X if bound to a TRUE.
 
D

D Riggins

I always use queries as recordsources for forms.

ruralguy via AccessMonster.com said:
Try using queries of your tables rather than the tables directly.



--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
D

D Riggins

Thanks. Your answer helped me figure it out even though the everything is in
native. Turns out that the subroms's current event had some code that
altered values in the fields on the subbform. Since the record deletion
triggers the curreent event, the the code was trying to update data in the
middle of the deletion - hence the "currently locked by another session"
message.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top