How can i pass variables from one form to another??
Printable View
How can i pass variables from one form to another??
If you only need to pass the variables into one function in a form you can set up that function to accept variables
Public Sub Edit(var1 as long, var2 as variant)
'
End Sub
If you need to change the values of these variables within this function you shoul pass them 'ByRef'. If however you will need to acces them throughout both forms then you are better off adding a module to your project and setting up the variables in the module as Global.
perhaps you want to declare a variable as Public in a code module
Project->Add Module
'example - only one line needed in the module
Public myVar as Integer
then you can use myVar in all forms in a project
Could always use PUBLIC PROPERTY GETs & LETs. At least it'll keep consistency with any classes that way.