Something it's useful to have a form serving as a viewer so data can't be add and/or edit and be able to change it as a editor on a click of a button
Here's the way I do it :
The Forms and subforms properties is set to
.AllowAdditions = false
.AllowEdits = False
then create a button that will contain the following code in the On Open events
[tt]
Me.AllowAdditions = True
Me.AllowEdits = True
'if there's no subform don't include the rest of the code
For Each myControl In Controls
Select Case myControl.ControlType
Case acSubform
myControl.Form.AllowAdditions = True
myControl.Form.AllowEdits = True
End Select
Next
[/tt]
The advantage of my code is that you don't need to enter the form/subforms name and you can add/remove subforms within the form without having to change that part of the code...code it and forget it!(just like the chicken in the ads).
there's surely some bad points to my code but like a good politician, I won't mention them
jul ^_^
"Computer Science is no more about computers than astronomy is about telescopes"
E. W. Dijkstra.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.