I guess a good question to ask is if there is "one" record per form
To answer your question roccorocks, Yes, I have one record per form.
I copied the code from my posting into a test form and it worked exactly as expected.
Dhookom, If It works when you tested, That means that I’m missing something that I don’t see it. Let me tell you what I do: (step by step)
1. Open the form with the record I want to lock
2. Change to Dedign view
3. Set the AllowEdits property on the form to No. (from Property Sheet, Data tab)
4. Set the On Current property (Event tab) of the form to the following event procedure:
Code:
Private Sub Form_Current()
Me.AllowEdits = IsNull(Me.CompletionDate)
End Sub
5. Save the form and open it in Form view.
Note: When the AllowEdits property is set to Yes, (step #3) the event procedure has no effect; I am still able to edit fields on the form. Now, when set the AllowEdits property to No, (step #3) It affects to all records; I’m not able to edit fields on all the records. And, I want to set the AllowEdits to false to only one specific record not to all of them.
I thought changing a field value programmatically causes the current record to be editable or not, regardless of the AllowEdits property settings.
Regarding the question:
Can I assume your Access 2007 allows code execution?
I don’t know how to test it.
Comp2008