lock a field after editing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luciegiles
    New Member
    • Oct 2007
    • 56

    lock a field after editing

    Is it possible to lock a field on a form or sub-form after it has been edited? I want to stop users changing data after it has been entered.

    Thanks you
  • Lysander
    Recognized Expert Contributor
    • Apr 2007
    • 344

    #2
    Yes, easily.

    Say the control on the form is called myName and the next field on the form is myAddress

    Then in the After_Update event of myName put the following code

    myAddress.setfo cus
    myName.locked=t rue
    myName.enabled= false

    (You have to change the focus before you disable the control)

    If you are doing this with lots of fields, be careful where you set the focus to, because if you try to setfocus to a control that is disabled it will fall over.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      Yes it certainly is.

      You will need to think carefully (and post the results of your thoughts too of course) about exactly which circumstances are required to trigger the locking, and very importantly too, exactly when they should be unlocked.

      If you can phrase the question fully and clearly we can certainly help further. For now, I will simply draw your attention to the .Locked available for every control.

      Comment

      Working...