locking fields in form based on values in other fields.

  • Thread starter Thread starter Kay
  • Start date Start date
K

Kay

I have a form with a field, called dobest, that collects
info for an instructor.

There are up to 3 instructors for each record. If there
is only one instructor, I'd like to lock the other two
dobest fields.

How do I do this?

Thanks,
Kay
 
Since you know that there is only one instructor, I'm guessing the record already exists
and you don't want someone to be able to add a 2nd or 3rd instructor.

In the Form's OnCurrent event, check the 2nd and 3rd instructor control (i.e. textbox) and
if it is blank set its Enabled property to False.

Example:
If IsNull(Me.txtInstructor2) Then
Me.txtInstructor2.Enabled = False
Else
Me.txtInstructor2.Enabled = True
End If
 
It appears that you're typing in the fields, you can't lock the fields but you can lock
the controls that hold the fields. The example I gave would be for a control (textbox,
combobox, listbox, combobox, etc) on the form.
 
Back
Top