How to lock a field for edits unless form is new?

E

Erin

How do I lock a field for editing in a record (form) that's been completed
but not in a form that's new?

I want the field to continue to display - just not be available for edits.

Trying the code to make it invisible gives me errors:

With Me
If .NewRecord Then
..cboDivisionSelect.Visible = True
..cboDivisionSelect.SetFocus
..Else
..cboDivisionSelect.Visible = False
End If
 
B

Beetle

In the Current event of your form;

If Not Me.NewRecord Then Me.cboDivisionSelect.Enabled = False
 
J

John Spencer

Better might be one or both of the following lines in the current event.

Me.CboDivisionSelect.Enabled = Me.NewRecord

Me.CboDivisionSelect.Locked = Not(Me.NewRecord)

That would switch the properties depending on whether or not this was a new
record or not.


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

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

Top