Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2002

    Unanswered: Locking controls/record?? on the form


    Any ideas will be appreciated.
    On my form I have a button cmdUpdate. The code behind this button runs some validation; selects data from one table and appends it to the other; updates the first table with the data from the form, entered by the user; and finally, if all of that done successfully, displays a label “Updated”.

    Once all appropriate tables are updated I don’t want users to change anything in this updated record on the form. So if lblUpdated. Visible = true I want to somehow lock all the controls on the form, and if not, have all the controls unlocked. The only solution I can think of is loop through the form’s controls and lock them one by one (or unlock) in the form’s current event. But I’m afraid it will be too slow. Are there any other ways to prevent users from changing data in the updated record in my particular situation?

    Thank you.

  2. #2
    Join Date
    Jun 2002
    Try to set the Locked = True (this is for the text boxes that you use for displaying the records)

  3. #3
    Join Date
    Apr 2002
    you could set the allowedits property of the form to false. this will prevent edits in all controls on the form and it's subforms (even applies to unbound controls). looping through the controls shouldn't be too big of a performance hog as long you have a reasonable amount of controls. worse than setting the locked property would be to do set any properties affecting the look of the control, you should set echo to false before looping through the controls to speed up the progress then.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts