About
Pricing
Community
Teams
Start Free Trial
Log in
marsattack32
asked on
3/6/2003
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
Visual Basic Classic
3
1
Last Comment
supunr
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
djshorty
3/6/2003
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MN_Dave
3/6/2003
Depending on what you want to do with it, you could also do something like this...
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
supunr
3/6/2003
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!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
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