title: Directly referencing userform entry in VBA instead of passing value to a variable
body: <p>folks.  I am new to programming, but I am writing some macros to help manage a shared Excel workbook for my job.</p>
  
  <p>I am implementing a few different user roles for people who need to access this workbook. The security is not very critical, just to prevent people from accidentally making (and saving) changes to things they shouldn't be. I am just having a UserForm prompt for the password and, based on what's entered, grant the proper access.</p>
  
  <p>I have it written so that the user's entry into textbox on the UserForm is referenced directly as <code>Me.textboxPasswordEntry.Value</code> for any comparisons. It occurs to me that this may not be best practice, but I can't put my finger on why. Maybe I'm just over thinking? At the same time, it seems silly and wasteful to declare a variable, pass the value to the variable, and then analyze that.</p>
  
  <p>The Sub below is from the UserForm, and I've included it to show you what I mean.  This is a very straight-forward scenario, I know, but am I courting trouble if I continue this practice through more complex ones?  If so, what kind of problems might I run into?</p>
  
  <p>Thanks.</p>
  
  <pre><code>Private Sub buttonOK_adminPW_Click()
  'The subs SetUserType_[level] are in the ChangeUserType module
  'AdminPass and DesignPass are module-level variables set on UserForm initialization
  'Default user type is User. Read-only access.
  'Admins can edit the workbook, but must save via a macro to ensure
  '   things are reset properly for Users (some sheets hidden, etc.)
  'Designers can edit the workbook, but also have full ability to save using
  '   the regular file menu/ctrl+s/etc.
  
      Application.ScreenUpdating = False
      Select Case Me.textboxPasswordEntry.Value
          Case AdminPass
              'Shows right control buttons and unlocks the wkbk for admin access
              SetUserType_admin
              Unload Me
          Case DesignPass
              'Shows all control buttons and unlocks the wkbk for designer access
              SetUserType_design
              Unload Me
          Case Else
              MsgBox ("Password incorrect. Please retry.")
              With Me.textboxPasswordEntry
                  .Value = ""
                  .SetFocus
              End With
      End Select
      Application.ScreenUpdating = True
  End Sub
  </code></pre>