Good Programming traits (1 Viewer)

GBalcom

Much to learn!
Joined
Jun 7, 2012
Messages
432
I'm in the middle of my most ambitious vba projects to date, and want to make sure I'm following any best practices that I can gather up. My main question is where to place some of my code. For instance, I have one form that will require a lot of code (for me anyways) to calculate some analytics for the form. At this point, I think it's unlikely I'll need this code anywhere else in the application, but who knows......So, should I place this code in a Module, or just keep it in the form itself?

Also, I'm looking for a good book on Access VBA, if anyone has one they can recommend. I'd prefer it deal with Access 2010, but am open to all suggestions.

Thanks,
Gary
 

gemma-the-husky

Super Moderator
Staff member
Joined
Sep 12, 2006
Messages
13,873
if you want to resuse it then put it in a module. also try and break your subs into smaller units, (ideally so each sub does one thing only) - which will also help make them more re-usable.

however, one point is that a form's code module knows about the controls on the form. if you put the code in a module, then you need a different treatment to manage data from the underlying form - as this direct link no longer exists.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom