Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

適用對象

BoundObjectFrame 物件

Image 物件

OptionGroup 物件

SubForm 物件

CheckBox 物件

Label 物件

Page 物件

TabControl 集合物件

ComboBox 物件

Line 物件

PageBreak 物件

TextBox 物件

CommandButton 物件

ListBox 物件

Rectangle 物件

ToggleButton 物件

CustomControl 物件

ObjectFrame 物件

Report 物件

Form 物件

OptionButton 物件

Section 物件

儲存 Microsoft Office Access 2007 應用程式所需之表單、報表、資料頁、章節或控制項的相關額外資訊。 讀/寫字串

expression.Tag

運算式 必要。 傳回 [套用至] 清單中其中一個對象的表達式。

備註

您可以輸入長度高達 2048 個字元的字串運算式。 預設設定為零長度字串 (" ")。

您可以使用物件的屬性工作表、巨集或 Visual Basic for Applications (VBA) 程式碼來設定此屬性。

與其他屬性不同的是,Tag 屬性設定不會影響任何物件的屬性。

您可以使用此屬性,將識別字串指派給物件,而不影響其他任何屬性設定,或造成其他副作用。 當您需要檢查當做變數傳遞至程序的表單、報表、資料頁、區段或控制項時,Tag 屬性非常實用。

範例

下列範例會使用 Tag 屬性顯示表單上控制項的自訂訊息。 當控制項具有焦點時,描述性文字會顯示在稱為 lblMessage 的標籤控制項中。 您可以將個控制項的 Tag 屬性設定為簡短的文字字串,以指定訊息的文字。 當控制項收到焦點時,系統會將其 Tag 屬性指派給標籤控制項的 Caption 屬性。 此範例會在表單上顯示名為 txtDescription 之文字方塊的描述性文字,以及名為 cmdButton 的命令按鈕。

Sub Form_Load()
Dim frmMessageForm As Form
Set frmMessageForm = Forms!Form1
frmMessageForm!lblMessage.Caption = "" ' Clear text.
frmMessageForm!txtDescription.Tag = _
"Help text for the text box."
frmMessageForm!cmdButton.Tag = _
"Help text for the command button."
End Sub
Sub txtDescription_GotFocus()
' Tag property setting as caption.
Me!lblMessage.Caption = Me!txtDescription.Tag
End Sub
Sub txtDescription_LostFocus()
Me!lblMessage.Caption = ""
End Sub
Sub cmdButton_GotFocus()
' Tag property setting as caption.
Me!lblMessage.Caption = Me!cmdButton.Tag
End Sub
Sub cmdButton_LostFocus()
Me.lblMessage.Caption = " "
End Sub

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×