The conventions are very handy while working in a team. So following are the prefixes of various types used to declare a variable name so that its properties can be identified easily.
Variable Prefixes:
Variable scope prefix conventions.These must be first in the name of variable.
Scope | Prefix |
---|---|
Global | g |
Module-level or form-level | m |
Local to procedure | None |
Variable Prefixes for Data Type
Data Type | Prefix |
---|---|
Boolean | bln |
Byte | byt |
Collection Object | col |
Currency | cur |
Date(Time) | dtm |
Double | dbl |
Error | err |
Integer | int |
Long | lng |
Object | obj |
Single | sng |
User-defined type | udt |
Variant | vnt |
e.g. blnTrueFalse, intCounter, sngDividend
We also have control prefixes.
Control Prefixes:
Control Type | Prefix |
---|---|
3D Panel | pnl |
ADO data | ado |
Animated button | ani |
Checkbox | chk |
Combo box, drop-down list box | cbo |
Command button | cmd |
Common dialog | dlg |
Communications | com |
Contorl (used within procedures when the specific type is unknown | ctr |
Data | dat |
Data-bound combo box | dbcbo |
Data-bound grid | dbgrd |
Data-bound list box | dblst |
Data combo | dbc |
Data grid | dgd |
Data list | dbl |
Data repeater | drp |
Date picker | dtp |
Directory list box | dir |
Drive list box | drv |
File list box | fil |
Flat scroll bar | fsb |
Form | frm |
Frame | fra |
Gauge | gau |
Graph | gra |
Grid | grd |
Header | hdr |
Hierachical flex grid | flex |
Horizontal scroll bar | hsb |
Image | img |
Image Combo | imgcbo |
Image list | ils |
Label | lbl |
Lighweight checkbox | lwchk |
Lightweight combo box | lwcbo |
Lightweight command button | lwcmd |
Lightweight frame | lwfra |
Lightweight horizontal scroll bar | lwhsb |
Lightweight list box | lwlst |
Lightweight option button | lwopt |
Lightweight text box | lwtxt |
Lightweight vertical scroll bar | lwvsb |
Line | lin |
List box | lst |
List view | lvw |
MAPI message | mpm |
MAPI session | mps |
MCI | mci |
Menu | mnu |
Month view | mvw |
MS char | ch |
MS flex grid | msg |
MS tab | mst |
OLE container | ole |
Option button | opt |
Picutre box | pic |
Picture clip | clp |
Progress bar | prg |
Remote data | rd |
Rich text box | rtf |
Shape | shp |
Slider | sld |
Spin | spn |
Status bar | sta |
System info | sys |
Tab strip | tab |
Text box | txt |
Timer | tmr |
Toolbar | tlb |
Tree view | tre |
Up-down | upd |
Vertical scroll bar | vsb |
Below is the prefixes for Data Access Objects (DAO)
Database Object | Prefix |
---|---|
Container | con |
Database | db |
DBEngine | dbe |
Document | doc |
Field | fld |
Group | grp |
Index | ix |
Parameter | prm |
QueryDef | qry |
Recordset | rec |
Relation | rel |
TableDef | tbd |
User | usr |
Workspace | wsp |
Menu And Constant Prefixes
Prefix for menu is mnu then menu name and then menu item name. e.g. mnuFileCut. Constant variables should be mixed case and should start with capital letter.