title: Unable to get DLookup value with variable field
body: <p>I have a userform in Access with name BAF_User with 2 fields (BAFUser, BRID).</p>
  
  <p>I am using the below code to get windows username and then compare it using DLookup and get the Full Name of the user who has logged into the Access file.</p>
  
  <pre><code>Option Compare Database
  
  Public Function GetUserName() As String
   Dim wshNet As Object
   Dim  As String
   Set wshNet = CreateObject("WScript.Network")
   GetUserName = wshNet.UserName
   Set wshNet = Nothing
   MyName = DLookup("[BAFUser]", "BAF_User", "[BRID] = '" &amp; GetUserName &amp; " '")
  End Function
  
  Private Sub Form_Load()
   MsgBox "Welcome" + MyName
  End Sub
  </code></pre>
  
  <p>But this is not showing the value, I am unable to catch what I have done wrong.</p>
  
  <p>Thanks for help.</p>