The following table lists Microsoft Access and Visual Basic functions and statements by programming task.
Table 3 Functions and Statements by Programming Task
Category | Task | Function or statement |
Arrays | Verify an array | IsArray |
Create an array | Array | |
Change default lower limit of an array | Option Base | |
Declare and initialize an array | Dim, Private, Public, ReDim, Static | |
Find the limits of an array | LBound, UBound | |
Reinitialize an array | Erase, ReDim |
Table 3 Functions and Statements by Programming Task (continued)
Category | Task | Function or statement |
Compiler directives | Define compiler constant | #Const |
Compile selected blocks of code | #If...Then...#Else | |
Control flow | Branch | GoSub...Return, GoTo, On Error, On...GoSub, On...GoTo |
Exit or pause the program | DoEvents, End, Exit, Stop | |
Loop | Do...Loop, For...Next, For Each...Next, While...Wend, With | |
Make decisions | Choose, If...Then...Else, Select Case, Switch | |
Indicate the beginning or end of a procedure | Function...End Function, Property Get...End Property, Property Let...End Property, Property Set...End Property, Sub...End Sub | |
Conversion | Convert ANSI value to string | Chr |
Convert to lowercase or uppercase | Format, LCase, UCase | |
Convert decimal number to other bases | Hex, Oct | |
Convert number to string | Format, Str | |
Convert one data type to another | CBool, CByte, CCur, CDate, CDbl, CInt, CLng, CSng, CStr, CVar, CVErr, Fix, Int | |
Convert string to ASCII value | Asc | |
Convert string to number | Val | |
Date and time | Get the current date or time | Date, Now, Time functions |
Convert serial number to date | Date, DateSerial, DateValue, Month, Weekday, Year | |
Convert serial number to time | Hour, Minute, Second, TimeSerial, TimeValue | |
Set the date or time | Date, Time statements |
Table 3 Functions and Statements by Programming Task (continued)
Category | Task | Function or statement |
Time a process | Timer | |
Perform date calculations | DateAdd, DateDiff, DatePart | |
Domain | Perform domain aggregate functions | DAvg, DCount, DMax, DMin, DStDev, DStDevP, DSum, DVar, DVarP |
Return a field value from a domain | DLookup | |
Dynamic Data Exchange (DDE) | Use Microsoft Access as a DDE client | DDEExecute, DDEInitiate |
Send data to another application | DDEPoke, DDESend | |
Request data from another application | DDE, DDERequest | |
Terminate a DDE conversation | DDETerminate, DDETerminateAll | |
Error handling | Get error messages | Error function |
Provide error information | Err | |
Generate run-time errors | Error statement | |
Trap errors during run time | On Error, Resume | |
Verify type | IsError | |
Return a Variant of subtype Error | CVErr | |
File and directory navigation | Change a directory or folder | ChDir |
Change the drive | ChDrive | |
Copy a file | FileCopy | |
Make a directory or folder | MkDir | |
Remove a directory or folder | RmDir | |
Return the current path | CurDir | |
Return file, directory, label attributes | GetAttr | |
Return a filename or volume label | Dir | |
Return a file date/time stamp | FileDateTime |
Table 3 Functions and Statements by Programming Task (continued)
Category | Task | Function or statement |
Return file length | FileLen | |
Rename a file, directory, or folder | Name | |
Set attribute information for a file | SetAttr | |
File input and output | Access or create a file | Open |
Close files | Close, Reset | |
Control output appearance | Format, Print, Print #, Spc, Tab, Width # | |
Copy a file | FileCopy | |
Get information about a file | EOF, FileAttr, FileDateTime, FileLen, FreeFile, GetAttr, Loc, LOF, Seek | |
Manage files | Dir, Kill, Lock, Unlock, Name | |
Read from a file | Get, Input, Input #, Line Input # | |
Return length of a file | FileLen | |
Set or get file attributes | FileAttr, GetAttr, SetAttr | |
Set read-write position in a file | Seek | |
Write to a file | Print #, Put, Write # | |
Financial functions | Calculate depreciation | DDB, SLN, SYD |
Calculate future value | FV | |
Calculate payments | IPmt, Pmt, PPmt | |
Calculate number of periods | NPer | |
Calculate internal rate of return | IRR, MIRR | |
Calculate present value | NPV, PV | |
Calculate interest rate | Rate | |
Math | Derive trigonometric functions | Atn, Cos, Sin, Tan |
Perform general calculations | Exp, Log, Sqr | |
Generate random numbers | Randomize, Rnd | |
Get absolute value | Abs |
Table 3 Functions and Statements by Programming Task (continued)
Category | Task | Function or statement |
Get the sign of an expression | Sgn | |
Perform numeric conversions | Fix, Int | |
Miscellaneous | Returns an RGB color code | QBColor, RGB |
Process pending events | DoEvents | |
Run other programs | AppActivate, Shell | |
Send keystrokes to an application | SendKeys | |
Generate sound from the computers speaker | Beep | |
Return a string associated with an operating system environment variable | Environ | |
Return a reference to an OLE Automation object | CreateObject, GetObject | |
Registry | Read program settings | GetSetting, GetAllSettings |
Save program settings | SaveSetting | |
Delete program settings | DeleteSetting | |
String manipulation | Compare two strings | StrComp |
Convert to lowercase or uppercase | Format, LCase, UCase | |
Create string of repeating characters | Space, String | |
Find length of a string | Len | |
Format a string | Format | |
Justify a string | LSet, RSet | |
Manipulate strings | InStr, Left, LTrim, Mid, Right, RTrim, Trim | |
Set string comparison rules | Option Compare | |
Work with ASCII and ANSI values | Asc, Chr | |
Convert strings | StrConv | |
Variables and constants | Assign values | Let |
Declare variables or constants | Const, Dim, Private, Public, New, Static |
Table 3 Functions and Statements by Programming Task (continued)
Category | Task | Function or statement |
Declare a module as private | Option Private Module | |
Get information about a Variant | IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType | |
Require explicit variable declarations | Option Explicit | |
Set default data type | DefBool, DefByte, DefCur, DefDate, DefDbl, DefInt, DefLng, DefObj, DefSng, DefStr, DefVar | |
Refer to current object | Me |