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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public Procedures....

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
Please could somebody explain in as simple a way as possible how to create a public procedures...

I have to take a value from one form text box into another form but I just cannot get it to work... do you use gotfocus() on the form retrieving the value or is there something else suitable?

Any simple examples would be appreciated....

Thanks
 
Hi there. There are several ways of doing it. I'm not sure of what exactly you want to do, but if you only need to use a text box value from one form on another you can just declare a public variable in one of your modules and then use it to store it's value and then just use it on the other form.

If you need more help with this or if this wasn't exactly what you were looking for, let me know.
 
Thanks for getting back to me... that's exactly what I want to do but I'm not sure what code to place into the module to recover the text from form 1 and then the code required to grab this text in form 2.

Sorry, but I'm pretty new with all of this...

Cheers...
 
If both forms are loaded, in the form_load event for Form2 you could put: Form2.Text1.Text = Form1.Text1.Text

If Form1 is NOT loaded at the time Form2 is called, then in a .BAS module, declare a public variable such as:

Public MyVariable As String

Once the text box on Form1 has something in it, then
MyVariable = Text1.Text

In the form_load event of Form2, say: Text1.Text = MyVariable

I hope this helps.
 
Take a look at faq222-400 in this forum.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top