I have a Project tracking database in MS Access 97. I want to add a field to contain a "Baseline" date for the planned completion of the project. Once this date has been entered I want to lock it so it cannot be altered, although I still want it to be visible to all on the form.
I thought it would be quite simple using the "Form_Current" event to test if the field was null or not. If null then lock it. Unfortunately it seems to lock the field on ALL records regardless of whether there is a date in it or not (blank). I would greatly appreciate any help........The code I am using is shown below.......
Private Sub Form_Current()
Dim strBaselineDate As String
strBaselineDate = IIf(Not IsNull(Me.txtBaseline), Me.txtBaseline, "NULL")
If strBaselineDate <> "NULL" Then
Me.txtBaseline.Enabled = False
Me.txtBaseline.Locked = True
End If
End Sub
I thought it would be quite simple using the "Form_Current" event to test if the field was null or not. If null then lock it. Unfortunately it seems to lock the field on ALL records regardless of whether there is a date in it or not (blank). I would greatly appreciate any help........The code I am using is shown below.......
Private Sub Form_Current()
Dim strBaselineDate As String
strBaselineDate = IIf(Not IsNull(Me.txtBaseline), Me.txtBaseline, "NULL")
If strBaselineDate <> "NULL" Then
Me.txtBaseline.Enabled = False
Me.txtBaseline.Locked = True
End If
End Sub