Lock

  • Thread starter Thread starter melbourno
  • Start date Start date
M

melbourno

I need to be able to lock Detailed Description field in a form when
the field contains
data. Obviously when creating a new record I need to be able to enter
data in
the field. I can lock the whole record and I can lock the field at
the
moment but it then does not allow me to enter data in new records
I tried the below codes:
Private Sub Detailed_Description_AfterUpdate()
Me.Detailed_Description = Now & ", " & Me.Detailed_Description
Me.Detailed_Description.Locked = Not IsNull(Me.Detailed_Description)
End Sub


And I also tried:

Private Sub Detailed_Description_AfterUpdate()
Dim blnUnlockControl
blnUnlockControl = Not Me.NewRecord
Me.Detailed_Description.Locked = bnlUnlockControl

Me.Detailed_Description = Now & ", " & Me.Detailed_Description
Me.Detailed_Description.Locked = Not IsNull(Me.Detailed_Description)
End Sub

And I tried:

Private Sub Detailed_Description_AfterUpdate()
If IsNull(Detailed_Description) Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
Me.Detailed_Description = Now & ", " & Me.Detailed_Description
End Sub

None of them worked....Can someone tell me please what I'm doing wrong
here

Thanks,

Mark
 
Put code to unlock the text box in the On Current event of the Form
(this event runs as the form loads or changes a record).

Private Sub Form_Current()

if isnull(detailed_description) then
detailed_description.locked = False
end if
 
Back
Top