totn Access

MS Access: Constants

In Microsoft Access, there are many built-in constants that are very useful. These built-in constants start with vb and some examples are vbYesNo, vbOkOnly, vbYes, and vbNo.

Commonly, built-in constants can be used to:

  1. Define the buttons that appear on a MsgBox
  2. Process the button click from a MsgBox

The MsgBox function allows you to interact with the user and process a button selection.

MsgBox

The following is an example of a MsgBox that is generated using vbYesNo as the MsgBox argument:

Microsoft Access

The vbYesNo constant places two buttons on the MsgBox - Yes and No.

You can also use the built-in constants in Access to process the results of a MsgBox. Based on the MsgBox above you might want to execute one set of code if the user clicks on the Yes button and another set of code if the user clicks No. In these cases, you would check the MsgBox return values for the constants vbYes and vbNo.

There are many ways you can use the built-in constants found in MSAccess. Here is a list of topics that explain what some of these usages in Access: