Locking a Required Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box (Due Date) that is a required field in a form. Once the
user completes this form and it is submitted, I do not want the user to
reopen the form and edit this field. Any help would be greatly appriciated.
 
One option (as there are different ways to handle such a situation), would be
to use the On Current event of the form to see if the DueDate has a value and
if it does locked down the controls so your users cannotn make changes.

Using a simple loop function to run through the controls on the form and set
their enabled properties accordingly.
 
Your post is a little vague on your requirements, especially the part about
"Once the user completes this form and it is submitted." What does
"submitting" the form consist of? If you simply want the the field locked
once the date is entered and the record is saved, the following will do:

Private Sub Form_Current()
If Not IsNull(Me.DueDate) Then
DueDate.Locked = True
Else
DueDate.Locked = False
End If
End Sub

Notice that I changed your control name to DueDate rather than Due Date.
Control names should never have spaces in them! This confuses Access! Follow
my example (the easiest way as far as I'm concerned) or use the underline
character, i.e. Due_Date.

IF the code above doesn't suit your needs, let us know along with more detail
on your "submission" process.

Good Luck!
 
"Once the user completes this form and it is submitted, I do not want the
user to reopen the form and edit *this* field." Per her posting, JudyB was
only concerned with locking the single Due Date field.

BTW, has anyone else been having problems with this site today? It took me
about two minutes to answer this post, and Daniel's response, stamped almost
20 minutes prior to mine, wasn't visible at the time!
 
You are correct, I want the the field locked once the date is entered and the
record is saved. This is the only text box on the form that I do not want
the user to be able to edit the information that was originally saved. This
is my first experience at working with Access. I am trying to modify one of
the templates to fit my needs. Where do I insert your information to lock
the DueDate?
 
Back
Top