Turn control to read only when editing but write when adding

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

Guest

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?
 
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
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top