Stores extra information about a form (form: An Access database object on which you place controls for taking actions or for entering, displaying, and editing data in fields.), report (report: An Access database object that you can print, which contains information that is formatted and organized according to your specifications. Examples of reports are sales summaries, phone lists, and mailing labels.), data access page (data access page: A Web page, published from Access, that has a connection to a database. In a data access page, you can view, add to, edit, and manipulate the data stored in the database. A page can also include data from other sources, such as Excel.), section (section: A part of a form, report, or data access page such as a header, footer, or detail section.), or control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) needed by a Microsoft Office Access 2007 application. Read/write String.
expression Required. An expression that returns one of the objects in the Applies To list.
You can enter a string expression (string expression: An expression that evaluates to a sequence of contiguous characters. Elements of the expression can be: functions that return a string or a string Variant (VarType 8); a string literal, constant, variable, or Variant.) up to 2048 characters long. The default setting is a zero-length string (zero-length string: A string that contains no characters. You can use a zero-length string to indicate that you know no value exists for a field. You enter a zero-length string by typing two double quotation marks with no space between them (" ").) (" ").
You can set this property by using the object's property sheet (property sheet: A pane that is used to view or modify the properties of various objects such as tables, queries, fields, forms, reports, data access pages, and controls.), a macro (macro: An action or set of actions that you can use to automate tasks.), or Visual Basic for Applications (VBA) (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Microsoft Windows-based applications and is included with several Microsoft programs.) code.
Unlike other properties, the Tag property setting doesn't affect any of an object's attributes.
You can use this property to assign an identification string to an object without affecting any of its other property settings or causing other side effects. The Tag property is useful when you need to check the identity of a form, report, data access page, section, or control that is passed as a variable to a procedure.
The following example uses the Tag
property to display custom messages about controls on a form. When a control has the focus, descriptive text is displayed in a label control called
. You specify the text for the message by setting the Tag
property for each control to a short text string. When a control receives the focus, its Tag
property is assigned to the label control's Caption
property. This example displays the descriptive text for a text box named
and a command button named
on a form.
Dim frmMessageForm As Form
Set frmMessageForm = Forms!Form1
frmMessageForm!lblMessage.Caption = "" ' Clear text.
frmMessageForm!txtDescription. = _
"Help text for the text box."
frmMessageForm!cmdButton. = _
"Help text for the command button."
' Tag property setting as caption.
Me!lblMessage.Caption = Me!txtDescription.
Me!lblMessage.Caption = ""
' Tag property setting as caption.
Me!lblMessage.Caption = Me!cmdButton.
Me.lblMessage.Caption = " "