Hi there,
I have a problem that I hope someone can assist me with.
Within Access 2007 I have a form[Contractors], within that form is a subform[SubContractors] and within the subform is a datasheet form[Payroll].
The Payroll datasheet consists of the following fileds; date, gross, materials, tax, fee, net.
At present the user can enter data into the fileds and if they need to make an adjustment at a later date they go back to the form and edit any fields they require. I have this already setup and working fine.
However, what I would really like to achieve is the following;
When the user is satisfied the data they have entered into a row is correct, could I put an extra field in the datasheet or a button within the form that allows the user to lock the row in question. I must point out that once the row is locked it must not able to be unlocked.
Is this possible?
Many thanks
"when "Yes" is selected will disable/lock/not allow edits to "
Your code Unlocks for Yes and Locks for No.
Also I had assumed the following error was a typo in your post but as you have now posted it twice I need to check.
If Me.Locked = Yes Then
should be
If Me.LockedYN = Yes Then
(assuming the lock field in the table is called LockedYN)
The locking and unlocking of either the form or of controls on the form has to be controlled in the Form_Current event procedure. If the purpose is to lock the whole record there is nothing to be gained from locking individual controls.
I am attaching a sample db which does what I understand you want.
If you open frmSample you will see a LockedYN checkbox. You can edit the record if the checkbox is false and you cannot edit the record if the checkbox is true.
db1.mdb