How-to: The Reddick VBA Naming Conventions - Object variables and DAO

Host application and component extensions to the conventions. Each host application for VBA, as well as each component that can be installed, has a set of objects it can use. This section defines tags for the objects in the various host applications and components. Future versions of the conventions will include tags for other VBA hosts and components.

Access 95, version 7.0 objects

Table 5 lists Access object variable tags. Besides being used in code to refer to these object types, these same tags are used to name these kinds of objects in the form and report designers.

Table 5. Access object variable tags.

Tag Object Type
app Application
chk CheckBox
cbo ComboBox
cmd CommandButton
ctl Control
ctls Controls
ocx CustomControl
dcm DoCmd
frm Form
frms Forms
grl GroupLevel
img Image
lbl Label
lin Line
lst ListBox
bas Module
ole ObjectFrame
opt OptionButton
fra OptionGroup (frame)
brk PageBreak
pal PaletteButton
prps Properties
shp Rectangle
rpt Report
rpts Reports
scr Screen
sec Section
sfr SubForm
srp SubReport
txt TextBox
tgl ToggleButton

Here are some examples:

txtName

lblInput

For OLE custom controls, you can use the tag OCX as specified in Table 5 or more specific object tags that are listed later in this article in Tables 11 and 12.

DAO 3.0 objects

DAO is the programmatic interface to the Jet database engine shared by Access, VB, and VC++. The tags for DAO 3.0 objects are shown in Table 6.

Table 6. DAO 3.0 object tags.

Tag Object Type
cnt Container
cnts Containers
db Database
dbs Databases
dbe DBEngine
doc Document
docs Documents
err Error
errs Errors
fld Field
flds Fields
grp Group
grps Groups
idx Index
idxs Indexes
prm Parameter
prms Parameters
pdbe PrivDBEngine
prp Property
prps Properties
qry (or qdf) QueryDef
qrys (or qdfs) QueryDefs
rst Recordset
rsts Recordsets
rel Relation
rels Relations
tbl (or tdf) TableDef
tbls (or tdfs) TableDefs
usr User
usrs Users
wrk Workspace
wrks Workspaces

Here are some examples:

rstCustomers

idxPrimaryKey

Copyright © 1995 Greg Reddick. You can freely distribute this document.

Related

  1. Introduction - Variable and Procedure names
  2. Prefixes
  3. Suffixes
  4. Object variables and DAO - variables
  5. Database Explorer objects - Table, Query, Form etc
  6. Object Name

 
Copyright © 1999-2024 SS64.com
Some rights reserved