-----Original Message-----
Rico,
To prevent users from changing text box contets is quite easy... assuming
you text box is called Text1 and your form is called frmMyForm, for this
example
1. in your form design set Text1 to Enabled > No, Locked
Yes
2. In the form's properties, use the On Current event to run this simple
code:
If Forms("frmMyForm").NewRecord = True Then
Me.Text1.Enabled = True
Me.Text1.Locked = False
End if
So far you have made your text box unaccessible by the user when they open
the form, and made accessipble when adding a new record.
Now, how to reverse the boolean values of the enabled / locked properties
once the data is entered is obvious; what I cannot tell you is what event to
use, since I am not familiar with what you are doing... give it some though,
I'm sure you'll figure it out.
If, for instance, you want to do this upon exiting the record, then you just
need to make a change to the On_Current code:
Me.Text1.Enabled = Forms("frmMyForm").NewRecord
Me.Text1.Locked = Not Forms("frmMyForm").NewRecord
This way it always be set to accessible for new records, unaccessible for
existing ones.
If, on the other hand, you want to make the text boxes unaccessible before
you leave the record, you'll have to figure out the right event (e.g.
another text box getting the focus?).
HTH,
Nikos
.