locking individual fields

pwicr

Registered User.
Local time
Today, 02:17
Joined
Sep 22, 2011
Messages
144
I have a check box to lock my field but if I click the check box it locks/unlocks the field for ALL the records.

Also, if I leave the form and come back it, it is just a shaded box (neither checked or unchecked) and is therefore unlocked so I have to "lock" it again which is pointless because I have to do it again the next time I open the form.
 
The checkbox would have to be bound to a field in the table to hold its value. To perform correctly for all records, the code would also need to be in the current event of the form.
 
Here is what things look like and the code.


Private Sub LOCK_CHASSIS_VIN_AfterUpdate()

Me.Serial_number.Locked = Nz(Me.LOCK_CHASSIS_VIN, 0)

End Sub
 

Attachments

  • LOCK FIELD.png
    LOCK FIELD.png
    17.3 KB · Views: 97
That's about what I expected, and it doesn't change my answer.
 
what do i do to what i have to fix it. i'm fairly new and need directions.
 
Which part? Not sure how to put it any clearer. The same code needs to be in the current event of the form. The current event fires when the user changes records, which will apply the appropriate locking. As to the checkbox, the only way Access will remember what it's value is when you get out of the program it is to have it bound to a field in the table.
 
Also, if I leave the form and come back it, it is just a shaded box (neither checked or unchecked)...
Just to reiterate what Paul said, the Checkbox Field LOCK_CHASSIS_VIN has to be bound to a Field in the underlying Table for this to work! Your comment above indicates that this is not the case!

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom