Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if the record is being edited by other user

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
hi

on my form I use lock 'edited record'

on the form_load or form_open how can I check if ther record is being edited and that this current record will only be open in the read-only mode

Thanks

 

Hi

What version are you in because from 95 to xp each version has had the record locking 'enhanced'.

regards
jo
 
I have Access 97 and there is no echnaced version
 
Use the Dirty function in your forms On Current Event Procedure as follows:

Private Sub Form_Current()
If Me.Dirty = True Then
MsgBox "This record is being edited"
End If
End Sub

HTH
Rick
 
Just to add to what RickD said; you can also call the users Username to see who the person is editing the record.(This is what i do and it works great). You could even go as far as locking records using this method. If you wish to go this far let me know and i can help
 
What I want to do is if the record is being modified, I want that another user wouldn't be able to even open the form for the modification of the same record

Is this possible to achieve?

Thanks
 
In the on_current event procedure which I outlined previously you could set the fields to locked, as follows:

Private Sub Form_Current()
If Me.Dirty = True Then
MsgBox "This record is being edited, you cannot update this record."
[field1].locked = True
[field1].locked = True
[field1].locked = True
'...etc I don't think you can lock the whole form so you have to lock the individual fields
else
[field1].locked = False 'this unlocks the field if not being worked on
[field1].locked = False
[field1].locked = False
End If
End Sub


Good Luck

Rick
 
My previous post should read:

In the on_current event procedure which I outlined previously you could set the fields to locked, as follows:

Private Sub Form_Current()
If Me.Dirty = True Then
MsgBox "This record is being edited, you cannot update this record."
[field1].locked = True
[field2].locked = True
[field3].locked = True
'...etc I don't think you can lock the whole form so you have to lock the individual fields
else
[field1].locked = False 'this unlocks the field if not being worked on
[field2].locked = False
[field3].locked = False
End If
End Sub

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top