Make Field on form conditionally editable

B

BlueWolverine

Hello,
MS Access 2003 on XP Pro.

I am going to be making a tabular form based on an updateable query and I
want to know how to make some field-records editable (meaning front end user
can change data) ONLY if the value that's in there to start is not null. If
it is NULL, I don't want the user to be able to change anything about that
"Cell".

So, parts of a record may be not null and I want those to be editable, and
some records in a field may be not null, and I want those to be editable, but
if any given "CELL" is null, I don't want it to be editable. (I want it to
stay NULL)


I'm hoping for a property or a conditional choice on lockable or something
like that but VBA would be fine.
Thanks.
 
L

Linq Adams via AccessMonster.com

Assuming you want to be able to enter data in the target field when the
record is new

Private Sub Form_Current()
If Me.NewRecord = False Then
If IsNull(Me.TargetField) Then
TargetField.Locked = True
Else
TargetField.Locked = False
End If
End If
End Sub

If you ***never*** want to be able to enter data in the target field in the
current form (for example, if the original data entry is done in another form)
:

Private Sub Form_Current()
If IsNull(Me.TargetField) Then
TargetField.Locked = True
Else
TargetField.Locked = False
End If
End Sub
 

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