Methods by Programming Task

The following table lists Microsoft Access and Visual Basic methods by programming task.

Table 1 Methods by Programming Task

Category Task Method
Combo box/list box Force a combo box to drop down Dropdown
  Return data in the bound column of a combo box or list box ItemData
Controls Set default properties of a control DefaultControl
  Size a control to fit the text or image it displays SizeToFit
  Undo changes to a control or form Undo
Filters Build a criteria string for a filter BuildCriteria
  Apply an existing filter ApplyFilter
Finding records Find a record according to specified criteria FindRecord
  Find next matching record FindNext

 

Table 1 Methods by Programming Task (continued)

Category Task Method
Graphics on printed reports Change the coordinate system Scale
  Draw a shape Circle, Line, PSet
  Find the size of text TextHeight, TextWidth
  Print text Print
Importing, exporting, or linking data Import, export, or link data in a database TransferDatabase
  Import, export, or link data in a spreadsheet TransferSpreadsheet
  Import, export, or link data in a text file TransferText
  Export data from a database to a Microsoft Excel workbook, a rich-text file, or a text file. OutputTo
Interacting with application and environment Generate sound from the computer’s speaker Beep
  Cancel an event CancelEvent
  Carry out a menu command DoMenuItem
  Toggle mouse pointer to hourglass Hourglass
  Maximize window Maximize
  Minimize window Minimize
  Move or resize the active window MoveSize
  Refresh the application title bar RefreshTitleBar
  Rename a database object Rename
  Restore window to original size and position Restore
  Send an object in an electronic mail message SendObject
  Set the state for a menu item on a custom toolbar SetMenuItem
  Toggle warning messages SetWarnings
  Toggle built-in toolbar ShowToolbar
Microsoft Access options Set or return Microsoft Access options GetOption, SetOption

Table 1 Methods by Programming Task (continued)

Category Task Method
Modules Add text to a module InsertText
Navigating through records Move to a specified record GoToRecord
Printing Print to Debug window Print
  Print the active object PrintOut
Quitting Microsoft Access Quit Microsoft Access Quit, Quit (DoCmd object)
Running code Run a procedure in another database Run
  Run a macro RunMacro
  Run an SQL statement RunSQL
Setting the focus Move the focus to the specified control GoToControl
  Move the focus to a form or control SetFocus
  Move to a specified page on a form with page breaks GoToPage, GoToPage (DoCmd object)
  Select a database object SelectObject
Updating data Update calculated controls or requery data for a form or control Recalc, Refresh, Requery, Requery (DoCmd object)
  Specify whether Microsoft Access updates the screen Echo
  Update the screen Repaint
  Update the screen for a specified database object RepaintObject
Working with a Collection object Add a member to a Collection object Add
  Remove a member from a Collection object Remove
  Return a specific member of a Collection object either by position or by key Item
Working with the Err object Generate a run-time error Raise
  Clear all property settings of the Err object Clear

Table 1 Methods by Programming Task (continued)

Category Task Method
Working with a database in the Microsoft Access window Create a new database NewCurrentDatabase
  Open an existing database OpenCurrentDatabase
  Close a database CloseCurrentDatabase
Working with database objects Open a database object OpenForm, OpenModule, OpenQuery, OpenReport, OpenTable
  Save a database object Save
  Close a database object Close
  Copy a database object CopyObject
  Delete a database object DeleteObject
Working with a Workspace object Clone the default Workspace object DefaultWorkspaceClone