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?
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.