How to Hide or show List or Library control

@Sternchen,

Please share the full code you used when testing the form and got these errors.

Not sure I understood you. Do you want to store the code in a file and re-use it on multiple forms? If so, please see this post.