Microsoft Access VBA Macro Programming

(Tina Sui) #1

Null value, 19–20
numeric types, 20–21
overview, 18, 20
string types, 21–22
variants, 18–19
See alsouser-defined types
databases, 239–240
linking to other Access databases, 240
locking, 284–287
See alsoADO; Linked Table
Manager; ODBC
date and time functions, 56–62
Date function, 57
DateAdd function, 57–58, 301–303
using to pause your code, 303
DateDiff function, 58
DatePart function, 58–59
DateSerial function, 59
Date/Time formats, 55
Date/Time values, 303
DateValue function, 60
DAvg method, 194–195
Day function, 60
DbEngine DAO object, 195–196
DCount method, 195
debug mode, 82–83
debugging
avoiding bugs, 90
breakpoints, 84
Call Stack dialog, 85–86
Debug window, 86–88
modes, 82–84
problem events, 88–89
running selected parts of code, 84–86
types of errors, 81–82
using message boxes, 89–90
using Stop statements, 82–84
See alsoerror handling
decisions, 36–38
Declare statement, 254
Delete method, 208
Delete query, 157–158
See alsoSQL queries
deleting code, 11
design time mode, 82
DFirst method, 196
dialogs
Color dialog, 126–128
Open File dialog, 124–125


overview, 123
Print dialog, 128
Save File As dialog, 126
Dim statements
and Access object models, 183
and local variables, 15–16
and static variables, 17
and variables, 14
Dirty property, 202
DLast method, 196–197
DLookup method, 197
DMax method, 197
DMin method, 197
Do Until loops, 42
DoCmd object, 197, 213
Beep method, 213–214
Close method, 214
CloseDatabase method, 214
Hourglass method, 214
Maximize method, 214–215
OpenForm method, 215
OpenQuery method, 215–216
OpenReport method, 216
OpenTable method, 216
PrintOut method, 216–217
Quit method, 217
RunCommand method, 217
SetWarnings method, 217–218
TransferSpreadsheet method, 218
TransferText method, 218–219
drilling down on charts, 325–327
DSNs, 241–243
using within Access, 243–245
DSum method, 197–198
DVar/DVarP methods, 198
dynamic arrays, 24
See alsoarrays

E
Edit method, 209
End..If statements, 37
EOF property, 209
error handling, 91–93
On Error Resume Next statement, 94
generating your own errors, 94–95
Resume statement, 93–94
See alsodebugging; errors
Error statement, 95

Index 367

Free download pdf