Re: Why use modules

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



1. How you name your subs, functions, variables, modules, children is entirely up to you, however keep in mind what my old prof used to say - "The true cost of software developement is NOT how much is costs to bring the application online, it is how much it costs to debug or revise the code afterward." The point being that at some point you or someone else is going to have go into your code and understand what it does. To that end, name everything in such a manner that its clear as to what it does. (I personally use prefixes to my field names & variables to indicate the type as in txtName tells me that the field is a TEXT type. lngTransportId tells me that the variable is DIM'd as LONG.)

2. The decision to spin out a procedure from an object's module to a free standing module depends on its purpose and expected use. I for one have a module named OUTLOOK FUNCTIONS that contains all my subs/functions that are my Access-Outlook interface. Although the subs are only called from one specific form, I wrote them in a manner so that they can be called from any form. I did that to make things easier if I needed to call them from other forms.

3. Now that I think of it, I've gotten into the habit that the only code in my forms/objects is code that is specific to those objects (requery a control, calling subs that need to run on form events, etc.). All others (form validation, Outlook/Word automation, functions, etc.) are in modules to allow for flexibility.

4. Never name your

Teewan wrote:
Hi all,

Can someone point me to information or give me an idea as to the advantages/diadvantages of using modules in my Access database. I've done a reasonable amount of coding for forms and events and while researching some information on automating outlook messages, tasks and reminders I'm trying to work out the dos and don'ts on using modules or can I just code this in to the cmdSave button which will be saving the information I need to put into the email messages. Also is there a naming convention Module 1 doesn't seem to informative.

Thanks in advance
.



Relevant Pages

  • Re: Error Message Help
    ... The two subs are not dealing with anything like Outlook, ... following fruit: ... It can happen in one of two different and unrelated subs. ...
    (microsoft.public.vb.general.discussion)
  • How to list sub and function
    ... I want to list all my subs and functions i have developped with VB in ... Word, Excell and Access. ... (Nor yet Outlook neither Powerpoint, ...
    (microsoft.public.word.vba.beginners)
  • Re: Outlook disables macros
    ... and see if vba is listed there. ... Michael Bauer - MVP Outlook ... VBOffice Reporter for Data Analysis & Reporting ... and subs. ...
    (microsoft.public.office.developer.outlook.vba)
  • Outlook disables macros
    ... Somehow Outlook disabled macros and I can not figure out how to enable ... writing some VBA for outlook and it was working fine. ... and subs. ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Money / Fees
    ... There are a number of subs options and if you decide that you need a change ... Fixed/Variable Costs ... There are essentially three ways of meeting the fixed costs: ... including payment of the AMS for every member. ...
    (uk.rec.scouting)