MS ACCESS:如何在 MS Access 的 table 中查找环境用户名,以便在文本框中返回全名?

MS ACCESS: How to lookup environ username in a table in MS Access so that the full name is returned in a textbox?

应用程序:MS ACCESS

1:我使用了在 Whosebug 中找到的这段代码(谢谢!)来获取数据库当前用户的用户名。问题是我需要在名为 "VCUsers" 的 table 中查找用户名以获取 "Participant".

2:这是"VCUsers"table。此处列出了用户名及其对应的 "Participant"。如何从 table 中查找通过 VBA 获得的用户名,以便 "Participant" 显示在主页的 "User" 文本框中?

3:这是主页和左上角的用户文本框。

See screenshots here.

作为VBA函数:

Public Function GetFullName() As String
    GetFullName = DLookUp("Participant", "VCUsers", "[User ID]='" & Environ$("username") & "'")
End Function

'=GetFullName()

表单加载时:

Private Sub Form_Load()
    Me.YourTextBoxName.Value = DLookUp("Participant", "VCUsers", "[User ID]='" & Environ$("username") & "'")
End Sub