Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Best way to pass data between forms?

I have a form (form A) that "shows" another form (form B). Form B collects
data that I want to be available to Form A when Form B is unloaded.

In addition I want to pass data from Form A to Form B when it is
instantiated. I assume I can set the value of hidden label when I create
form B, but this seems a little stupid.

Any advice on how to do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Best way to pass data between forms?

Declare a public variable in a standard code module, simplest way.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"fedude" wrote in message
...
I have a form (form A) that "shows" another form (form B). Form B collects
data that I want to be available to Form A when Form B is unloaded.

In addition I want to pass data from Form A to Form B when it is
instantiated. I assume I can set the value of hidden label when I create
form B, but this seems a little stupid.

Any advice on how to do this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Best way to pass data between forms?

On Jun 3, 7:46*am, fedude wrote:
I have a form (form A) that "shows" another form (form B). *Form B collects
data that I want to be available to Form A when Form B is unloaded.

In addition I want to pass data from Form A to Form B when it is
instantiated. *I assume I can set the value of hidden label when I create
form B, but this seems a little stupid. *

Any advice on how to do this?


I agree with Bob. Declare Public variables in a standard module and
then set them as needed. For instance, if you want textbox1 on Form B
to be populated when it opens with the value from textbox2 on Form A,
you could use:

Standard module:
Public example As String

Button on Form A that opens form B
example = Me.textbox2

Initialize event of Form B
Me.textbox1.Text = example

HTH
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Best way to pass data between forms?

Do I just creat another module anyhere in the spreadsheet or is there
someplace special I need to declare these variables?

"JW" wrote:

On Jun 3, 7:46 am, fedude wrote:
I have a form (form A) that "shows" another form (form B). Form B collects
data that I want to be available to Form A when Form B is unloaded.

In addition I want to pass data from Form A to Form B when it is
instantiated. I assume I can set the value of hidden label when I create
form B, but this seems a little stupid.

Any advice on how to do this?


I agree with Bob. Declare Public variables in a standard module and
then set them as needed. For instance, if you want textbox1 on Form B
to be populated when it opens with the value from textbox2 on Form A,
you could use:

Standard module:
Public example As String

Button on Form A that opens form B
example = Me.textbox2

Initialize event of Form B
Me.textbox1.Text = example

HTH

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Best way to pass data between forms?

On Jun 3, 10:49*am, fedude wrote:
Do I just creat another module anyhere in the spreadsheet or is there
someplace special I need to declare these variables?



"JW" wrote:
On Jun 3, 7:46 am, fedude wrote:
I have a form (form A) that "shows" another form (form B). *Form B collects
data that I want to be available to Form A when Form B is unloaded.


In addition I want to pass data from Form A to Form B when it is
instantiated. *I assume I can set the value of hidden label when I create
form B, but this seems a little stupid. *


Any advice on how to do this?


I agree with Bob. *Declare Public variables in a standard module and
then set them as needed. *For instance, if you want textbox1 on Form B
to be populated when it opens with the value from textbox2 on Form A,
you could use:


Standard module:
Public example As String


Button on Form A that opens form B
example = Me.textbox2


Initialize event of Form B
Me.textbox1.Text = example


HTH- Hide quoted text -


- Show quoted text -


They just need to be declared at the top of a standard module. I
typically create a module for nothing but my public declerations.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Best way to pass data between forms?

Thank You.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass value to excel userform - is there a constructor? how to pass Rich Excel Programming 6 August 14th 07 09:18 AM
pass data between workbooks VishalBade Excel Programming 2 September 21st 06 10:09 AM
How to pass data from UserForm to spreadsheet susan Excel Programming 1 September 2nd 06 09:36 PM
Pass Data from List Boxes in Userform ExcelMonkey[_190_] Excel Programming 1 February 19th 05 10:45 PM
Using Multiple User Forms to pass info from one to the other Neal Excel Programming 2 December 14th 04 12:29 AM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"