Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

KBV - What's the difference between a module and a macro?

Discussion in 'Information Technology' started by KBV, Jul 28, 2006.

  1. KBV

    KBV
    Expand Collapse
    Guest

  2. Loading...

    Similar Threads Forum Date
    What's The Exact Meaning Of Sangat.... Questions and Answers Feb 14, 2015
    USA What's the United States Up To in Asia? Breaking News Nov 19, 2011
    What's his name? (Dhadrianwale?) Questions and Answers Jul 31, 2011
    What's the right thing to do? General Jun 12, 2011
    SciTech What's in Store for Technology in 2011? Breaking News Dec 19, 2010

  3. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    A macro is a series of instructions that ms-access can execute.

    A module is a place where you can put in VBA code. The other difference is
    that you cannot run a module, but you can run a macro.

    However, you can most certainly run code that is placed into a module.


    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     
  4. KBV

    KBV
    Expand Collapse
    Guest

    Thank you - one more question, if you can't run a module, how exactly do you
    get it to execute the VBA code that you write?

    "Albert D.Kallal" wrote:

    > A macro is a series of instructions that ms-access can execute.
    >
    > A module is a place where you can put in VBA code. The other difference is
    > that you cannot run a module, but you can run a macro.
    >
    > However, you can most certainly run code that is placed into a module.
    >
    >
    > --
    > Albert D. Kallal (Access MVP)
    > Edmonton, Alberta Canada
    > pleaseNOOSpamKallal@msn.com
    > http://www.members.shaw.ca/AlbertKallal
    >
    >
    >
     
  5. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Modules contain Functions or Subroutines. You call them to run the code.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "KBV" <KBV@discussions.microsoft.com> wrote in message
    news:EEC665AE-0816-451E-9F0D-62265FE262A1@microsoft.com...
    > Thank you - one more question, if you can't run a module, how exactly do
    > you
    > get it to execute the VBA code that you write?
    >
    > "Albert D.Kallal" wrote:
    >
    >> A macro is a series of instructions that ms-access can execute.
    >>
    >> A module is a place where you can put in VBA code. The other difference
    >> is
    >> that you cannot run a module, but you can run a macro.
    >>
    >> However, you can most certainly run code that is placed into a module.
    >>
    >>
    >> --
    >> Albert D. Kallal (Access MVP)
    >> Edmonton, Alberta Canada
    >> pleaseNOOSpamKallal@msn.com
    >> http://www.members.shaw.ca/AlbertKallal
    >>
    >>
    >>
     
  6. Larry Linson

    Larry Linson
    Expand Collapse
    Guest

    "Douglas J. Steele" wrote

    > Modules contain Functions or Subroutines.
    > You call them to run the code.


    And, Forms and Reports have associated Modules in which you can place code
    that is executed when particular Events occur (such as the OnCurrent event,
    which executes for each different record that is displayed, or the Open
    event, which executes when the Form is opened). It is most often from this
    "event code" that Functions and Sub Procedures in standard Modules are
    called, but they can also be called from Macros, using the RunCode step in
    the macro.

    Larry Linson
    Microsoft Access MVP
     
  7. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    "KBV" <KBV@discussions.microsoft.com> wrote in message
    news:EEC665AE-0816-451E-9F0D-62265FE262A1@microsoft.com...

    > Thank you - one more question, if you can't run a module, how exactly do
    > you
    > get it to execute the VBA code that you write?
    >


    Well, you have a few answers already.

    To run code in a module, you can

    * Call the code from a button on a form (the on-click code can call code
    in the module)

    * You can place your cursor in the code in the module and hit f5 to run

    * you can type in the debug window

    Call NameOfYourSubInModule

    So, any button you build can call the code. You can also manually run the
    code as above from the debug window.

    And, of couse one of the many "events" that a form or even a text box has
    can also call code in a module.

    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     
  8. Tony Toews

    Tony Toews
    Expand Collapse
    Guest

    KBV <KBV@discussions.microsoft.com> wrote:

    Another difference is that macros are easier to understand and work
    with from a beginners viewpoint. Modules, which contain VBA code are
    harder to get going in but are much more flexible and can do a lot
    more than macros.

    Macros don't have error handling while modules aka VBA code do.

    Tony
    --
    Tony Toews, Microsoft Access MVP
    Please respond only in the newsgroups so that others can
    read the entire thread of messages.
    Microsoft Access Links, Hints, Tips & Accounting Systems at
    http://www.granite.ab.ca/accsmstr.htm
     

Share This Page