marsattack32
asked on
How to set a form by a variable?
I am tyring to pass a form name into a moduels and use that form name to set the form to that form. I can't get the codes to work, can anyone help
public sub setformto(frmname as string)
dim frm as form
set frm=forms(frmname)
end sub
public sub setformto(frmname as string)
dim frm as form
set frm=forms(frmname)
end sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
public sub setformto(frmname as string)
dim frm as form
For Each f In Forms
if (f.Name = frmName) then
set frm=f
Exit for
End if
Next
end sub
Good Luck!
dim frm as form
For Each f In Forms
if (f.Name = frmName) then
set frm=f
Exit for
End if
Next
end sub
Good Luck!
The command1 is a button on a form named form1. Text1 is a text box on form1.
Private Sub Command1_Click()
set_Form Me
End Sub
Public Sub set_Form(frm As Form1)
frm.Text1 = "Hi There!"
End Sub