vocedicore
02-13-2019, 09:02 PM
Hi All,
I have 2 different userform as origin and 1 userform as destination, 1 module to manipulate data sending.
it need to be copy variables to destination userform variables.
But if variables not exist in destination userform, variables will not proceed to copy.
1) Please advise how to check if variable is exist on destination userform.
2) How to copy those group of variable dealing with for each in loop?
I appreciate it in advance.
for each obj in variables in frmDest
obj = frmOrgA.obj 'if variable exist, the variables name is same
next obj
frmOrgA(Userform): 3 variable (strA as string, strB as string, strC as string)
frmOrgB(Userform): 4 variable (strA as string, strB as string, strC as string)
frmDest(Userform): 3 variable (strA as string, strB as string, strC as string)
------frmOrgB(Userform)----------
Public Sub cmdDest_Click()
Set Tg = frmDest
Call IncomingSync(Me, Tg)
End Sub
------Global(Module)-----------
Public Sub IncomingSync(OrgUF As Object, TgUF As Object)
ICrun = False: ICrun = True
TgUF.strA = OrgUF.strA ' can be use for each in?
TgUF.strB = OrgUF.strB
TgUF.strC = OrgUF.strC
If not TgUF.strD is nothing Then TgUF.strD = OrgUF.strD 'can I detect if variable is exist?
frmDest.Show
End Sub
I have 2 different userform as origin and 1 userform as destination, 1 module to manipulate data sending.
it need to be copy variables to destination userform variables.
But if variables not exist in destination userform, variables will not proceed to copy.
1) Please advise how to check if variable is exist on destination userform.
2) How to copy those group of variable dealing with for each in loop?
I appreciate it in advance.
for each obj in variables in frmDest
obj = frmOrgA.obj 'if variable exist, the variables name is same
next obj
frmOrgA(Userform): 3 variable (strA as string, strB as string, strC as string)
frmOrgB(Userform): 4 variable (strA as string, strB as string, strC as string)
frmDest(Userform): 3 variable (strA as string, strB as string, strC as string)
------frmOrgB(Userform)----------
Public Sub cmdDest_Click()
Set Tg = frmDest
Call IncomingSync(Me, Tg)
End Sub
------Global(Module)-----------
Public Sub IncomingSync(OrgUF As Object, TgUF As Object)
ICrun = False: ICrun = True
TgUF.strA = OrgUF.strA ' can be use for each in?
TgUF.strB = OrgUF.strB
TgUF.strC = OrgUF.strC
If not TgUF.strD is nothing Then TgUF.strD = OrgUF.strD 'can I detect if variable is exist?
frmDest.Show
End Sub