Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Values To Different Forms

Status
Not open for further replies.

Figzus

Programmer
Mar 21, 2005
36
0
0
US
I know this is probably the easiest question there is but how do you send the value of a textbox in one form to another text box in another form. Thanks for helping.
 
Hi.
I suppose you're using excel and so you can load only one form at once.
So you have to use a global variable.
A global variable must be written in a macro module (not in a Userform module) so as to be visible from any routine.

In a module:
(In general area at the top of the module)
declare the variable


Public myvar


In an event (change, afterupdate....) of 1st form textbox
write the code to copy the value


myvar = Me.Textbox1.value


After, in 2d form t.box, in load event or whereever you
prefere, write the code to pass the value to 2d tbox


Me.TextBox1.value = myvar


Hope this helps
Bye
Nick

 
or...
Code:
Userform2.Textbox1.text = Userform1.Textbox1.text


Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top