record locking

R

richard harris

I have a main fomr with subforms.

i need to edit records for one of the sub forms, so i close the main form,
open the edit form, do my work, close the edit form and reopen the main form
(this is to update the data on the subform)

what is happening is that wheni go back to the main form aftter editing and
try to edit another part of the form i am giving a message saying that the
record is locked by another user.

i believe that when closing the form something is not closing the record
properly.

can anyone please help me.

thanks

richard
 
T

tina

it might be easier to open the Edit form without closing the main form. in
the Edit form's Close event, run code that requeries the subform on the main
form, as

Forms!MainFormName!SubformControlName.Form.Requery

substitute the correct form and control names of course, and make sure that
you use the name of the subform control (within the main form) that "holds"
the subform - not the name of the subform as it appears in the database
window. sometimes those two names are the same, but sometimes not.

hth
 
R

richard harris

hi tina,

thanks for this. i found out that it was a line of code i had put (on close
event of the subform) in to enter a date in another subform on the main form
was causing the issue.

i got around this by having the subform which was to receive the date, open,
receive the date and close in the background. a bit crude but the user does
not see it and works well.

i will try your method to see if that stops me form neeidng to do the above.

thansk

richard
 
T

tina

you're welcome, glad you found something that works for you. :)
btw, a subform is specifically a form nested inside another form. when you
open a form in a separate window, it is not a subform. i'm not being
nitpicky; when using the term subform, it refers to a specific type of
object that has specific properties and behaviors, and is manipulated in
specific ways - that are different from forms. when discussing issues with
other Access developers, it's important to use the correct terminology, so
as not to cause confusion and frustration all around.

hth
 
Top