Enable control/field if in Add New Record page/form

  • Thread starter Thread starter Steve Stad
  • Start date Start date
S

Steve Stad

I have a field that I disable in the Edit mode of a form but I would like to
Enable the same field/control when the same form is in the 'Add new Record'
mode. Can you tell me the code and event to use.
 
In the form's OnCurrent event (every time it moves to a new record), include
this code:

If Me.NewRecord Then
Me.Controlname.Enabled = True
Else
Me.Controlname.Enabled = False
End If


this could be simplified to one line:

Me.Controlname.Enabled = Me.NewRecord


Or, if you are talking about the AllowAdditions and AllowEdits properties,
you can use the Open even of the form to set it (though there's no particular
advantage that I can think of to do it this way over using the Current event)

Me.Controlname = Me.AllowAdditions


hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Back
Top