Turning AllowEdits to false for individual fields within a form/sub-form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kate2272
    New Member
    • Apr 2009
    • 8

    Turning AllowEdits to false for individual fields within a form/sub-form

    Hi Guys

    I was wondering if it is possible to turn AllowEdits to false after data has been entered for individual fields within a form/sub-form. I've found that I can do this in the 'AfterUpDate' by assigning Me.AllowEdits = False .... BUT this then doesn't allow me to update data in other fields within that form/sub-form after it has been saved ... it seems to assign this property all the other fields within the form/sub-form ...

    Any assistance would be greatly appreciated.

    Cheers
    Kate
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You can Lock the individual fields. IF you only want to lock the field after the record is saved, use

    Code:
    Private Sub Form_Current()
    If IsNull(Me.YourTargetField) Then
      YourTargetField.Locked = False
     Else
      YourTargetField.Locked = True
     End If
    End Sub
    If you want to lock the field as soon as data is entered and the user tabs out of the field, use the above code and add this:
    Code:
    Private Sub YourTargetField_AfterUpdate()
    If IsNull(Me.YourTargetField) Then
      YourTargetField.Locked = False
     Else
      YourTargetField.Locked = True
     End If
    End Sub
    I have to warn you, as I do with everyone doing this kind of thing, you need to have some strategy in place for editing the field if it becomes necessary, as it almost always does!

    Linq ;0)>

    Comment

    • kate2272
      New Member
      • Apr 2009
      • 8

      #3
      Thank you Linq

      Hi Linq,
      Thanks heaps for your help. The fields in question are defaulted to automatically display date and time of commencement of the record ... therefore, it is important that these fields aren't altered after the record has been saved, so the record can be accurately monitored for efficiency for completion.
      Thank you once again.
      Kind regards
      Kate

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Glad we could help, Kate!

        Linq ;0)>

        Comment

        Working...