Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro or VB code - what is best practice

Status
Not open for further replies.

blackduck

Programmer
Jun 11, 2002
119
AU
I have just come across a sample database in office.microsoft called Issues Database. It contains a lot of macros. I havent used macros before, I usually use buttons from the control toolbox and then go into view code, with help from the wizard also.

What is the 'best practice', or the 'for and against' using macros as apposed to vba code?
 
I think you will find that most people here prefer code. It is more powerful and easier to spot problems.
 
I support Remou.(Oh no I mean support vba than macro)

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Code every time other than two scenarios:

1. An AutoKeys macro (this can't be done globally in code, as far as I know).

2. A startup macro (other than AutoExec, when I'd just use a startup form) that is called with a command line switch.

The main reason is code is more powerful and has error trapping.

Ed Metcalfe.

Please do not feed the trolls.....
 
Thanks guys, you just saved me heaps of time trying to work out how all these macros were done. Will stick with learning code.

cheers
blackduck
 
You might be aware that you can convert macro to code.
Tools > Macro > Convert....

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks ZmrAbdulla, I didn't know that and will give it a go.

Do you know if it is good code? ie. Microsoft word can be converted to web (html) but the code is dreadful - full of unwanted extras that you dont want to learn.
 
Watch out for Wizard code, for example, it uses DoCmd.DoMenuItem whereas Microfort recommends DoCmd.RunCommand.
 
Duane,

Really? Why??

Unless macros are considerably more powerful and robust in Access 2007 I don't think that's something I'd consider.

Ed Metcalfe.

Please do not feed the trolls.....
 
I haven't been using Access 2007 but I understand there are lots of improvements to the macros over the previous versions so it seems MS is continuing to invest in them.

Off-topic to this thread: I am a Microsoft Access MVP and we just spent a couple days at Redmond looking into the future. Access is [red]not[/red] dead. There is a very dedicated and hard working team of programmers, program managers, testers, and others creating some cool new features. I am truly sorry I can't provide some additional information :-(.

Duane
Hook'D on Access
MS Access MVP
 
Well I'm happy to hear that development is continuing, although I'm far from convinced that they're going in the direction I'd hope for. :-(

Perhaps they could spend some time developing an improved security model for the new Access file format. Or just reinstate the one we had before! :)

Ed Metcalfe.

Please do not feed the trolls.....
 
Duane,

No problem. Understood.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top