The error is fairly self-explanatory. txtCustName is used, but not defined, in Form1. You’ll need to define the variable before you can use it, in a syntax like:
Dim txtCustName As Textbox
Does txtCustName (which I’m assuming is meant to be a Textbox) exist on your form? If not, create it.
solved Variable is not declared. Permission level error