Crackers
05-03-2005, 12:52 AM
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.
maxmangion
05-03-2005, 01:23 AM
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.
Pat Hartman
05-03-2005, 09:07 PM
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:
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.