Turn control to read only when editing but write when adding

  • Thread starter Sarah at DaVita
  • Start date
S

Sarah at DaVita

I have a control that is a look up to find a value. I want to make the
control read only if the record is being edited and allow it to be changed
when a new record is added? How do you do that?
 
A

Allen Browne

Use the Current event of the form to lock the control if you are not at the
new record:

Private Sub Form_Current()
Me.[NameOfYourControlHere].Locked = Not Me.NewRecord
End Sub
 
S

Sarah at DaVita

Thanks!!!!

Allen Browne said:
Use the Current event of the form to lock the control if you are not at the
new record:

Private Sub Form_Current()
Me.[NameOfYourControlHere].Locked = Not Me.NewRecord
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sarah at DaVita said:
I have a control that is a look up to find a value. I want to make the
control read only if the record is being edited and allow it to be changed
when a new record is added? How do you do that?
 
Top