Results 1 to 5 of 5
  1. #1
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67

    Referencing and Changing A Form Module Variable From A Module

    I would like to reference and subsequently change the value of a variable I have in a form module from another module..

    So, in the form named frm_order, the variable is in the form's module and is named frm_var_1. This variable is declared as a public variable.



    I then created a module via the module tab called mod_check, in which I want to reference and change the variable frm_var_1.

    Is this possible?

    Also, what is the appropriate way to refer to these types of modules. I would imagine anything created in a form is a 'Form' module. What about modules created using the modules tab? What is the technical name for them?

    Thanks for any assistance..

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by orcinus View Post
    I would like to reference and subsequently change the value of a variable I have in a form module from another module..
    that doesn't really seem normal, but I've heard it being done.

    vba has an extensibility library in it. If I remember right, you don't need any externals for it. search the reference list for "vba extensibility". that's the only way that I know of, that you can modify the code in the vba project from code in the same vba project.

    it works fine, as I've used it plenty of times.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Public variables outside of any procedure in the code module of a Form become properties of the Form. You can then reference them through the Forms collection.
    Forms.frm_order.frm_var_1 = What ever you want...

  4. #4
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67
    Quote Originally Posted by RuralGuy View Post
    Public variables outside of any procedure in the code module of a Form become properties of the Form. You can then reference them through the Forms collection.
    Forms.frm_order.frm_var_1 = What ever you want...
    Thanks, this works. Much appreciated..

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you ready to use the Thread Tools and mark this thread as Solved?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Close Form from Module
    By tonere in forum Modules
    Replies: 3
    Last Post: 03-24-2011, 10:56 AM
  2. Replies: 7
    Last Post: 12-29-2010, 04:07 PM
  3. Replies: 3
    Last Post: 10-15-2010, 11:17 AM
  4. Track form and module design changes
    By c_smithwick in forum Modules
    Replies: 0
    Last Post: 05-11-2010, 10:28 AM
  5. Variable Table Names in a Module
    By Jessica in forum Modules
    Replies: 1
    Last Post: 04-19-2010, 07:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums