Passing variables between two subforms

G

Guest

I’m new to VBA programming...

What is the best way to pass several variables from one procedure to another
in a different module (or actually, one subform to another subform)? I’ve
had success passing variables if I specify them when I call the procedure,
Call procedurename(var1, var2, var3). The only problem I’ve had with this is
that when anything goes wrong in the called procedure, the debug inevitably
goes to the call statement rather then the actual error in the second
procedure.

I’ve tried using the public keyword to declare the variables in the general
declarations area of subform1, and I am then able to use the variable in
subform2 (referring to it as: Form_formname.variablename), but the value is
always reset to zero or blank. I’ve also tried using the STATIC keyword to
define the variables within the first procedure, but this doesn’t allow the
variable to pass to second procedure since it’s in a separate module.

Ideas? Thanks in advance.
 
A

Alex Dybenko

Hi,
if these 2 subforms are on the same main form - you can use main form public
method or properties to set/get values
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top