Locking Text Boxes

Crackers

Registered User.
Local time
Tomorrow, 08:11
Joined
May 31, 2002
Messages
36
When you enter a figure into a text box, is there any method that will lock that figure in so that it cannot be changed at a later viewing. Or is this pushing the envelope too far.

Thank you in advance for helping.
 
in the afterupdate event of your textbox put

Me.FieldName.Locked = True

However, this way, remember that if put type something incorrect, you need to unlock it, in order to correct the mistype.
 
The Current event of the form is a better place for this code.

If you don't want to allow any updates to a record once it has been saved, set the AllowEdits and AllowDeletions properties to No if the record is not new:
Code:
If Me.NewRecord Then
    Me.AllowEdits = Yes
    Me.AllowDeletions = Yes
Else
    Me.AllowEdits = No
    Me.AllowDeletions = No
End If
You can also add the second part of the code to the AfterUpdate event of the form. This will prevent the form from being updated twice.

If it is only a few fields, you would use the same logic except you would use the .Locked property of the fields and set .Locked to Yes or No depending on if you were in a new record or not.
 

Users who are viewing this thread

Back
Top Bottom