PC Review


Reply
Thread Tools Rate Thread

Best way to pass data between forms?

 
 
fedude
Guest
Posts: n/a
 
      3rd Jun 2008
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?
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      3rd Jun 2008
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" <(E-Mail Removed)> wrote in message
news:6741FFB5-EFCA-4508-9D6E-(E-Mail Removed)...
>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?



 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      3rd Jun 2008
On Jun 3, 7:46*am, fedude <fed...@discussions.microsoft.com> 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
 
Reply With Quote
 
fedude
Guest
Posts: n/a
 
      3rd Jun 2008
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 <fed...@discussions.microsoft.com> 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
>

 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      3rd Jun 2008
On Jun 3, 10:49*am, fedude <fed...@discussions.microsoft.com> 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 <fed...@discussions.microsoft.com> 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.
 
Reply With Quote
 
fedude
Guest
Posts: n/a
 
      4th Jun 2008
Thank You.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how pass data between forms =?Utf-8?B?dGNsb3Vk?= Microsoft VB .NET 5 1st Jul 2005 12:32 PM
Pass Data between 2 forms =?Utf-8?B?Q2FzZXk=?= Microsoft Dot NET 12 25th Nov 2004 05:19 AM
How to pass data between two forms? =?Utf-8?B?Lk5ldEhlbHBXYW50ZWQ=?= Microsoft VB .NET 1 15th Jun 2004 06:07 AM
Switch between forms and pass data Brian C Microsoft Access Forms 6 1st May 2004 01:55 AM
Pass data between forms hugh Microsoft VB .NET 8 28th Mar 2004 04:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:57 AM.