eseabrook2008
Technical User
Background:
I have a main form with a combo box. Each item in the combo box opens a subform where the users selects certain info and clicks submit which assigns values to public variables and closes the subform. This works as designed. Since I will have multiple subforms, I want to create a function to assign the value of the public variable to a variable on the main form rather than re-typing the code for each item in the combo box.
rather than doing this:
I want to do something like this:
But this doesn't work because it's assigning the string, not the object.
I have a main form with a combo box. Each item in the combo box opens a subform where the users selects certain info and clicks submit which assigns values to public variables and closes the subform. This works as designed. Since I will have multiple subforms, I want to create a function to assign the value of the public variable to a variable on the main form rather than re-typing the code for each item in the combo box.
rather than doing this:
Code:
CASE 1
...
FINALbldgCode = subform1.bldgCode
FINALMultOcc = subform1.MutlOcc
FINALContsChge = subform1.ContsChge
FINALEXTRA = subform1.EXTRA
Case 2
...
FINALbldgCode = subform2.bldgCode
FINALMultOcc = subform2.MutlOcc
FINALContsChge = subform2.ContsChge
FINALEXTRA = subform2.EXTRA
I want to do something like this:
Code:
CASE1
....
formname = "subform1"
FINAL()
Case2
....
formname = "subform2"
FINAL()
Public Sub FINAL()
FINALBldgCodeNo = FORMNAME & ".bldgCodeNo"
FINALMultOcc = FORMNAME & ".MultOcc"
FINALOccChge = FORMNAME & ".OccChge"
FINALContsChge = FORMNAME & ".ContsChge"
FINALEXTRA = FORMNAME & ".EXTRA"
But this doesn't work because it's assigning the string, not the object.