Importing values from form to module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Charalambides

    Importing values from form to module

    Is there a way I can import a given value to a variable from the main form
    to a module? I wanted to have some routines that are repeated set in a
    module subroutine. However, the value of a variable I need to use in the
    equations are not read and the equation's result is erroneous. So if I have
    a variable to which a value was assigned in the form how can I set it to
    have the same value in the module?


  • IS

    #2
    Re: Importing values from form to module

    How about declaring a Global variable?
    i.e. Global strSomething as String

    "Jason Charalambides" <nospam@protect ionplan.com> wrote in message
    news:YV3Eb.6609 1$HH.51438@fe1. texas.rr.com...[color=blue]
    > Is there a way I can import a given value to a variable from the main form
    > to a module? I wanted to have some routines that are repeated set in a
    > module subroutine. However, the value of a variable I need to use in the
    > equations are not read and the equation's result is erroneous. So if I[/color]
    have[color=blue]
    > a variable to which a value was assigned in the form how can I set it to
    > have the same value in the module?
    >
    >[/color]


    Comment

    • Larry Serflaten

      #3
      Re: Importing values from form to module

      "Jason Charalambides" <nospam@protect ionplan.com> wrote[color=blue]
      > Is there a way I can import a given value to a variable from the main form
      > to a module? I wanted to have some routines that are repeated set in a
      > module subroutine. However, the value of a variable I need to use in the
      > equations are not read and the equation's result is erroneous. So if I have
      > a variable to which a value was assigned in the form how can I set it to
      > have the same value in the module?[/color]


      How are you calling the module? Could you not pass your variable in
      as a parameter?

      LFS





      -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
      http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
      -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

      Comment

      • Randy Birch

        #4
        Re: Importing values from form to module

        Variables declared Public in a BAS module are available across the project.
        Just ensure you do not declare a variable of that same name within a
        procedure, or within the general declarations of a form, as when in that
        routine or form, VB will use that locally-defined variable and not the
        global variable.

        --

        Randy Birch
        MVP Visual Basic

        Please respond only to the newsgroups so all can benefit.


        "Jason Charalambides" <nospam@protect ionplan.com> wrote in message
        news:YV3Eb.6609 1$HH.51438@fe1. texas.rr.com...
        : Is there a way I can import a given value to a variable from the main form
        : to a module? I wanted to have some routines that are repeated set in a
        : module subroutine. However, the value of a variable I need to use in the
        : equations are not read and the equation's result is erroneous. So if I
        have
        : a variable to which a value was assigned in the form how can I set it to
        : have the same value in the module?
        :
        :


        Comment

        Working...