How do i get a varible to go from one form to another
if you want to see the code email
[email protected]
Printable View
How do i get a varible to go from one form to another
if you want to see the code email
[email protected]
One way is to use a public variable in a .BAS module and use this public from both forms.
Another way is to put a public variable at the form level in the second form and load the second form from the first form, set the variable, then show the second form. If you put a public variable at the form (general declarations) level on a form it can be easily accessed with form.variablename notation just like any other form property/method. It's kind of like adding a rough property to your form (without the Property Let/Get routines). For example, in your second form you might have something like (at the general declarations section):
Public Incoming As Variant
From the first form you could then do something like:
Load Form2
Form2.Incoming = "hello world!"
Form2.Show
Paul
Either use a Public Variable or Property in the Form code:
Code:Public sPublicVar as String
Private sPrivateVar as String
Property Get PrivateVar() as String
PrivateVar = sPrivateVar
End Property
Property Set PrivateVar(ByVal sIn as String)
sPrivateVar = sIn
End Property