I have a form which I want to prevent data being inadvertently modified once a record is created. I am using a field in my underlying record which is a yes/no field, and a checkbox on the form tied to that field. Using the "on current" event for the form, I am placing the following code. This works very well with existing records, however when I create a new record, all of my controls are locked from the getgo, with no way to enter data, even though their default value is unlocked. I have tried adding a string of code setting the locked property to false if my checkbox value is false, even though that shouldn't be necessary, however that hasn't resolved my issue.
Any help will be appreciated.
If Me.chkLock = True Then
Me.txtPlantcode.Locked = True
Me.txtUsedFor.Locked = True
Me.txtCostCenter.Locked = True
Me.Abbrev.Locked = True
Me.Project.Locked = True
Me.txtWBS.Locked = True
Me.txtTask.Locked = True
Me.MaximoWO.Locked = True
Me.ForBldg.Locked = True
Me.Combo74.Locked = True
Me.Combo82.Locked = True
Me.Engineer.Locked = True
Me.Planner.Locked = True
Else
End If
If Me.chkLock = True Then
Me.txtPlantcode.Locked = True
Me.txtUsedFor.Locked = True
Me.txtCostCenter.Locked = True
Me.Abbrev.Locked = True
Me.Project.Locked = True
Me.txtWBS.Locked = True
Me.txtTask.Locked = True
Me.MaximoWO.Locked = True
Me.ForBldg.Locked = True
Me.Combo74.Locked = True
Me.Combo82.Locked = True
Me.Engineer.Locked = True
Me.Planner.Locked = True
Else
Me.txtPlantcode.Locked = False
Me.txtUsedFor.Locked = False
Me.txtCostCenter.Locked = False
Me.Abbrev.Locked = False
Me.Project.Locked = False
.....
But your seeming to say that you've already done that, so put a STOP right above the If check. Trying adding a record.
You'll hit the stop. use F8 to step through and see what's happening.
Jim.