I've got basically a self built navigation panel consisting of several buttons. This navigation panel is consistent throughout all of the main forms, and presently the approach I've taken is to just copy the code that it runs off of throughout all the forms.
I know there has to be a more effecient way of coding this, but I'm a little bit confused with how Class modules/regular modules vs. form modules work. Is there a public function or procedure I could write that would store this code once and then I could call it whenever the buttons were clicked with a simple line of code?
Before I posted this I tried to stick this in a Module and declare it as a Public sub to be referenced on the control click. I think part of my problem though is that the code references controls on the form. I'm not sure how to handle this in the Module, besides maybe changing
Me.btnCPByJobNum.Visible = True
to
Forms.variable.btnCPByJobNum.Visible = True
and then in the procedure on the form declaring the variable and setting it to the form name. I'm just guessing right now though.