code and macros living in harmony? (1 Viewer)

Best way to learn Access

  • Trial and error. trudge through forums and search Google.

    Votes: 2 100.0%
  • Buy a book. I suggest....

    Votes: 0 0.0%
  • Watch hours of YouTube.

    Votes: 0 0.0%
  • Give up. It's hopeless.

    Votes: 0 0.0%

  • Total voters
    2

reillc01

New member
Local time
Today, 11:27
Joined
Apr 11, 2010
Messages
6
"Hello world"

I'm an excel junkie turned Access fanatic, but very new to the environment. I am slowly learning how VBA works and basic database design. As is typical for me, my aspirations are higher than my skill and the learning curve is slow. I have started with (what I thought would be simple) employee database.

How do I incorporate the snipits of code I have found to address specific problems with the macros? Obviously, using macros is much easier for me at this point in my Access knowledge, and I am able to build actions, but run into problems that seem to be solvable by code. Where/how do I implement these patches without converting the whole macro to VBA?

Am I just better off, working through books on VBA and giving up macros? Of course my goal is to get my DB up and running as quickly as possible. I have found many great articles on the web, but the hunting for specific answers technique leads me to believe that I may not be approaching my design as efficiently as I could. I'm sure my beginner level problems are encountered by every Access newbie, but I have not found any resources that bridge the gap between the introductory "this is Access" type tutorials and "try this code" solutions. Any suggestions there?

Any sage advice and/or nuggets of wisdom would be greatly appreciated!
 

Mr. B

"Doctor Access"
Local time
Today, 10:27
Joined
May 20, 2009
Messages
1,932
I can tell you from experience that making the transition from exclusively using macros to actully programming in VBA is quite a move. I can remember thinking "how in the world do those guys ever learn what to use and when to use it." One of the ways of making the transition easire for me was to have Access to convert certain macros to VBA code so I could see what the resulting VBA code looked like. This seemed to let me transition a little easier.

You will find that there are very basic commands and methods that are used much more frequently that others. Start using the more basic commands and writing basic code. Then when you need assistance, ask. Ask for specific assistance here and other places and then follow the suggestions that best suit your situation. You will also find that when using VBA, there are many ways to accomplish the same thing.

Good luck with your learing curve.
 

Banana

split with a cherry atop.
Local time
Today, 08:27
Joined
Sep 1, 2005
Messages
6,318
I code exclusively in VBA after a bad experience with macros very early in my Access-developer days. The main issue is that macros has no error handling and if something goes bad, it is quite unpleasant experience for end users.

However, I have a change of attitude with upcoming Access 2010. Here's a nice blog post explaining how it's different in 2010. There, they addressed several of shortcomings of macros and with the new designer structured somehow similar to a procedural language, it is much faster to set up a If/Then block or even a Loop block in a macro than in VBA and that can be done with much less chance of errors. Error handling are also provided as well.

But that's all new and you probably are actually asking about macros for versions out in wild already. (2007? 2003? 2000? 97?) For that, I should point out that I do occasionally use AutoExec or AutoKeys. I also know at least two other developers who use macros to quickly build simple actions (e.g. closing a form via a button for example) but happily revert to VBA for say, cascading comboboxes on the same form. So yes, you can have both and use as you like. Just be aware of macros' shortcoming.

Mr. B already gave you the useful tip of converting a macro to VBA to get an idea of how it is done in VBA.


Best of luck!
 

Users who are viewing this thread

Top Bottom