#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2009
    Posts
    24
    Rep Power
    0

    Difference between Macro code and VBA?


    Hi

    I'm very hazy as to whether there is a difference between macro code and vba. Surely if you use an event handling procedure such as clicking a command button it could triger normal vba code in that procedure. Does Access record something different when you just use the wizard (in terms of the code) or is there no difference?

    Every book just jumps right in without explaining this.

    Any help on this would be greatly appreciated. Thanks.

    danny2000
  2. #2
  3. Contributing User
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Oct 2005
    Location
    @ 8300' in the Colorado Rocky Mountains
    Posts
    1,008
    Rep Power
    163
    Not real sure about your question but the big differences are that code if far more flexible and extensible and allows for error handling.
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2009
    Posts
    24
    Rep Power
    0
    Originally Posted by RuralGuy
    Not real sure about your question but the big differences are that code if far more flexible and extensible and allows for error handling.
    Thanks. I just don't understand when I'm 1 - creating a macro and what does that macro code look like. Does it use the same syntax as VBA? If it does, why would there be an option to convert it to VBA?

    2 - Can you confirm that a macro is created when you access the properties of a control in design view.

    Thanks
    danny2000
  6. #4
  7. Contributing User
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Oct 2005
    Location
    @ 8300' in the Colorado Rocky Mountains
    Posts
    1,008
    Rep Power
    163
    Originally Posted by danny2000
    2 - Can you confirm that a macro is created when you access the properties of a control in design view.
    Only when that is what you want it to do.
  8. #5
  9. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jan 2007
    Location
    Northern California
    Posts
    3,536
    Rep Power
    763
    Originally Posted by danny2000
    when I'm creating a macro and what does that macro code look like. Does it use the same syntax as VBA? If it does, why would there be an option to convert it to VBA?
    No, macros and VBA are totally independent of each other and share almost no syntax.

    VBA is a programming language, derived from Visual Basic. Macros are technically not programming, they are a simplified way to string together sequential commands.

    Many of the same operations can be done either by using a macro or writing a VBA procedure, so it's usually possible to convert a macro into an equivalent VBA procedure, but the reverse is generally not possible, since a fully featured programming language can do a lot that macros cannot.

    Can you confirm that a macro is created when you access the properties of a control in design view.
    I don't really understand your question. Certainly the direct answer is No.
    Experience is the thing you have left when everything else is gone.
  10. #6
  11. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2009
    Posts
    24
    Rep Power
    0

    Wink Macro's and VBA


    Thanks everyone. I think I understand now.
    When I look at a macro created when I access the properties of a control and look at the code created by that macro it looks similar to VBA.

    I was really just trying to understand what we are converting it to when we use the Convert to VBA function in access. At a glance the code looked similar if not almost the same.

    Thanks again for coming back.

    danny2000
  12. #7
  13. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jan 2007
    Location
    Northern California
    Posts
    3,536
    Rep Power
    763
    Originally Posted by danny2000
    Thanks everyone. I think I understand now.
    When I look at a macro created when I access the properties of a control and look at the code created by that macro it looks similar to VBA.

    I was really just trying to understand what we are converting it to when we use the Convert to VBA function in access. At a glance the code looked similar if not almost the same.

    Thanks again for coming back.

    danny2000
    Oh, I think I now see what you are referring to. Those are not and never were macros. That is 100% VBA, perhaps created by a wizard, but not a macro, which is something entirely different. Macros are created by opening the Macros tab in the Database Window and entering macro commands on successive lines. This has no relation to VBA and event procedures.

IMN logo majestic logo threadwatch logo seochat tools logo