You would use the normal .access code to disable the subform. By making the code work at the top level of the subform, everything in it will be disabled.
You need to decide how the code is triggered. Do you want it to execute from a button click, PrePrint, PreSubmit. The same code is needed.
You might want to build in a way to unlock it as well. Create a way to have .access = "enabled";