By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Querying a record's edit lock state

P: 19
Is there a way to determine whether another record has been pulled up in a form in edit mode PRIOR to allowing that record to be used/opened in the same form? I've described a similar question about record locking, but am still trying to solve and wondered whether there was a way to access the record's attributes/properties that would tell me it's locked for editing before someone else tries to open it.
Jul 26 '07 #1
Share this Question
Share on Google+
4 Replies


FishVal
Expert 2.5K+
P: 2,653
Is there a way to determine whether another record has been pulled up in a form in edit mode PRIOR to allowing that record to be used/opened in the same form? I've described a similar question about record locking, but am still trying to solve and wondered whether there was a way to access the record's attributes/properties that would tell me it's locked for editing before someone else tries to open it.
Hi, Nestor.

I think DAO.Recordset.EditMode property is what you are looking for.
Jul 26 '07 #2

P: 3
Not sure if you are after this but i would try
If CurrentProject.AllForms("Form1").IsLoaded = True Then
MsgBox "Form1 is already in Use"
Else
DoCmd.OpenForm "Form1"
End If
Jul 26 '07 #3

P: 19
Ok. If I read it right, the checking of the form status will keep others from also opening that form. If this is correct, then I have explained myself wrongly. I do not want to keep others from opening the form (edit record form), but keep them from opening the SAME record in the form used for editing.

As for the other method, will this lock the record set, eg. all the records in the underlying query? How do I target checking the state of a specific record (e.g. customerId #5555 is currently being edited in the "frmCustomerInfoEdit").

I have a continuous form which shows a complete list of customers - "CustList". On that form, there is a button next to each customer that, when clicked, opens another form with full customer details to allow editing/updating.

I want to prevent anyone else from selecting the same customer while someone else currently has the specific customer's record already open. I am trying to generate an error message "record is currently locked" or similar, but preventing that record from being selected.

I have tried setting a value in a field in the record to indicate that it has been locked. However, using "setvalue" only sets the value for a control object and doesn't , on-load,does not immediately write the value to the record table. I have tried using setvalue on a form object and then using requery to get it to write to the table. However, requery is leaving it in a state of "writing" that then prevents other user edits to be written.

I hope I have been clear enough. Let me know if I can provide any othe details.

Thanks a bunch!
Jul 26 '07 #4

P: 19
Work Around:
if record had a null field [reclocked] then I set open the record in the edit form and onload use a sql update (no warnings) to set the field to 1. when any of the various "done' type buttons are pressed in the edit form, I setvalue in this field back to null.
Jul 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.