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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code Standards??

Status
Not open for further replies.

moolie

Programmer
May 7, 2002
193
0
0
CA
I'm looking for a good website with coding standards for VBA for Access 2k and/or VB6. If anyone has a suggestion for publication let me know. I'm doing some code clean up on another programmers applications and I'm finding it difficult to manage without some standard to follow. I have my way and they had theirs. Maybe even some reference for industry standards outlining documentation and comments, variable declaration, data access strings and their distruction etc. etc.
 
Hi,

One of the most commonly used naming conventions used by MS Access/VB is the Leszynski/Reddick convention, availlable for download as a word document from:


There is no such thing as an industry standard naming convention as every programmer has his/her own preferences, but for Access/VBA, the Reddick is as near universal as you will get (other languages have their own).

I would also ensure that source code has up to date meaningful comments on the operation of complex code areas in addition to including details of what it does, what the parameters to functions/subs do, what it returns (if a function), who wrote it and when. As an example, in code I write I put the following block at the top of each function:

Code:
' Purpose: 
' Author: John Barnett (tek-tips handle jrbarnett)
' Date: 
' Comments:

and I fill in the rest as needed.

John
 
The Access MVPs put up a link that apparently builds on the "Leszynski/Reddick" standard, and expands it to Access objects:


But I don't like some of the things in there (for one, it's too incredibly detailed--who cares what prefix we put for the "Relationship" object?)

Anyway, just do jrbarnett's link (the standard L/R convention) and additionally, make sure your "Access objects" follow this convention:

Tables: tblTableName
Queries: qryQueryName
Forms: frmFormName
Reports: rptReportName
Modules: basModuleName for general; clsClassName for classes.


I think that will do.
 
don't know if it says these things in the docs, but i'll add this: do not use spaces in any object names (field, table, query, etc). not that it won't work, but it can cause problems later.
for example, instead of First Name, use FirstName.

also use descriptive names; do not leave a combo box as cbo1 or whatever they call it. make it cboReportChoice or whatever. same with all controls, at least those that are referenced in code or have code attached to them. otherwise some poor guy is gonna be reading thru code not knowing which form control is text1 or text2 or text3.

anyhow, my buck-two-fitty worth........
 
jrbarnett, you posted a link to a doc that I can't get to. Is there another location for this file that I can download the doc from??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top