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.

StringFromGUID 函數會將 GUID,即位元組類型 陣列 ,轉換為 字串。

語法

StringFromGUID ( guid )

必要的 guid 自 變數是一組 位元組 數據,用來唯一識別作業系統的應用程式、元件或數據項。


註解

Microsoft Access 資料庫引擎會將 GUID 儲存 為位元組類型陣列。 不過, Microsoft Office Access 2007 無法從 表單 或 報表上的 控制項 傳回 元組數據。 若要從控件傳回 GUID 的值,您必須將其轉換為字串。 若要將 GUID 轉換成字串,請使用 StringFromGUID 函數。 若要將字串轉換回 GUID,請使用 GUIDFromString 函數。

例如,使用資料庫複寫時,您可能需要參照包含 GUID 的欄位。 若要傳回系結至包含 GUID 欄位之表單上控制元件的值,請使用 StringFromGUID 函數將 GUID 轉換為字串。

範例

附註: 下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。

下列範例會傳回在字串窗體中 Employees 表單上s_GUID控件的值,並將它指派給字串變數。 s_GUID控件系結至s_GUID欄位,即在複本資料庫中新增到每個復本數據表的其中一個系統字段。

Public Sub StringValueOfGUID()
Dim ctl As Control
Dim strGUID As String
' Get the GUID.
Set ctl = Forms!Employees!s_GUID
Debug.Print TypeName(ctl.Value)
' Convert the GUID to a string.
strGUID = StringFromGUID(ctl.Value)
Debug.Print TypeName(strGUID)
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!

×