Locked controls in a form

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a datasheet form, that is on a tabcontrol, that has 3 controls
ActionDate (Default value is Date())and ActionTime Default value is Time())
and Action Log (which is a text box). All the controls have their their
locked property set to Yes. I also have this code in the OnCurrent Event of
the form:
Private Sub Form_Current()
If Me.NewRecord Then
Me.Action_Date.Locked = False
Else
Me.Action_Date.Locked = True
End If
If Me.NewRecord Then
Me.Action_Time = False
Else
Me.Action_Time.Locked = True
End If
If Me.NewRecord Then
Me.Action_Log.Locked = False
Else
Me.Action_Log.Locked = True
End If
End Sub

When the form opens the date and time are present. However as soon as I
start to type into the text box which is the Action Log control the time
reverts to 00:00:00. The date stays as it should ie todays date.
Does anyone know why this is happening?
Thanks
Tony
 
I have a datasheet form, that is on a tabcontrol, that has 3 controls
ActionDate (Default value is Date())and ActionTime Default value is Time())
and Action Log (which is a text box). All the controls have their their
locked property set to Yes. I also have this code in the OnCurrent Event of
the form:
Private Sub Form_Current()
If Me.NewRecord Then
Me.Action_Date.Locked = False
Else
Me.Action_Date.Locked = True
End If
If Me.NewRecord Then
Me.Action_Time = False
Else
Me.Action_Time.Locked = True
End If
If Me.NewRecord Then
Me.Action_Log.Locked = False
Else
Me.Action_Log.Locked = True
End If
End Sub

When the form opens the date and time are present. However as soon as I
start to type into the text box which is the Action Log control the time
reverts to 00:00:00. The date stays as it should ie todays date.
Does anyone know why this is happening?
Thanks
Tony

Did you mean to write this:
Me.Action_Time = False
or this?
Me.Action_Time.Locked = False
 
Thanks I've been staring at that for about an hour and never spotted it???
Time for a break I think
Cheers
tony
 
Back
Top