how to lock a field if equal to a value

ppsandy

New member
Local time
Tomorrow, 06:22
Joined
Oct 9, 2008
Messages
8
I'm still using Access 2003 to manage our membership database, is it possible to lock a field(member's name) if the membership is equal to withdrawal or terminated? Kindly help!!!

Possible to use "on click"?

 
Last edited:
Hello,

You have the "Locked" propriety of a control.
A code like this
Code:
If Me.Membership = "withdrawal" or Me.Membership="terminated" then
Me.MemberName.Locked = True
end If
You put it at AfterUpDate event of the MemberShip Control
Good continuation
 
For multi valued colums you can use this in after update event
RequiredField=MultiColumnField.Column(1)
 


You have the "Locked" propriety of a control.
A code like this
Code:
If Me.Membership = "withdrawal" or Me.Membership="terminated" then
Me.MemberName.Locked = True
end If
You put it at AfterUpDate event of the MemberShip Control

In the AfterUpdate it would only be tested after the MemberName was changed. This would be too late. The test must be performed in the OnCurrent event to that it is tested each time the current record is changed.

However this would leave the control permanently Locked after the first time one of the values was encountered becuase there is nothing to ever change it back.

By far the easiest way to do this task is with ConditionalFormatting.
Save the design with Enabled = No on MemberName.

In the ConditionalFormatting on the MemberName control:
Expression Is
Code:
[Membership] <> "terminated" And [Membership] <> "withdrawal"
Tick the Enable checkbox.

This technique also has a major advantage that it can be used in ContinuousForms.
 

Users who are viewing this thread

Back
Top Bottom