Results 1 to 3 of 3

Thread: How do i get a varible to go from one form to another

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    youngstown, oh
    How do i get a varible to go from one form to another

    if you want to see the code email

  2. #2
    One way is to use a public variable in a .BAS module and use this public from both forms.

    Another way is to put a public variable at the form level in the second form and load the second form from the first form, set the variable, then show the second form. If you put a public variable at the form (general declarations) level on a form it can be easily accessed with form.variablename notation just like any other form property/method. It's kind of like adding a rough property to your form (without the Property Let/Get routines). For example, in your second form you might have something like (at the general declarations section):

    Public Incoming As Variant

    From the first form you could then do something like:

    Load Form2
    Form2.Incoming = "hello world!"


  3. #3
    Lively Member
    Join Date
    Aug 2000
    Ontario, Canada
    Either use a Public Variable or Property in the Form code:

      Public sPublicVar as String
      Private sPrivateVar as String
      Property Get PrivateVar() as String
        PrivateVar = sPrivateVar
      End Property
      Property Set PrivateVar(ByVal sIn as String)
        sPrivateVar = sIn
      End Property

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width