This guide contains numerous code examples that you can use to experiment with the concepts covered. Unless otherwise noted, the code is compatible with VBA 5.0 as it is implemented in Visual Basic 5.0, Microsoft Access 97, Microsoft Excel 97, Microsoft PowerPoint 97, Microsoft Word 97, and other applications that host VBA 5.0.
This guide uses the following conventions in the sample code:
If rstCustomerList.RecordCount = 0 Then strText = "Empty" Public Const dbOpenRecordset = 2
' This is a comment. Dim intNew As Integer ' This is also a comment.
Sub MyCode () Dim intX As Integer, intP As Integer, intQ As Integer If intX > 0 Then intP = intQ End If End Sub
Naming Conventions for Database Objects and Variables
Object | Prefix | Example |
Container | con | conForms |
Database | dbs | dbsCustomers |
Document | doc | docReport |
Dynaset | dyn | dynOrders |
Error | err | errCurrent |
Field | fld | fldLastName |
Group | gru | gruUsers |
Index | idx | idxPrimaryKey |
Parameter | prm | prmBeginDate |
Property | prp | prpValue |
QueryDef | qdf | qdfShowCustomers |
Recordset | rst | rstCustomers |
Relation | rel | relOrdersItems |
Snapshot | snp | snpReadOnly |
Table | tbl | tblOrders |
TableDef | tdf | tdfCustomers |
User | usr | usrMary |
Workspace | wrk | wrkPrimary |
Naming Conventions for Visual Basic Variables
Data type | Prefix | Example |
Byte | byt | bytAttributes |
Currency | cur | curDollars |
Date | dte | dteToday |
Double | dbl | dblPi |
Boolean | f | fInitialized |
Integer | int | intCount |
Long | lng | lngAttributes |
Single | sng | sngDays |
String | str | strLastName |
Type (user-defined) | typ | typPartRecord |
Variant | var | varTemp |
See Also For more information about naming conventions, see “The Leszynski Naming Conventions for Microsoft Jet” Help file in the Papers folder on the companion CD-ROM.