title: Creating a login form that use tables in Access 2007
body: <p>I have created a login from, in it I have placed a "Username" field
  I have managed to find a code that compares the value entered into this field (Username)
  and as a result displayed a message</p>
  
  <p>What I can not do is connect the value entered in the "username" filed to an existing table</p>
  
  <p>Explanation:<br>
  I have a table of users and permissions (each user has permission)<br>
  For example:<br>
  Record 1: Username = 1 , permission = normal<br>
  Record 2: Username = 2 , permission= Special</p>
  
  <p>I want to write code or macro that will take the value entered into the "username" field
  and compare it to this table and then it will displayed an appropriate message</p>
  
  <p>For example:<br>
  If the user write 1 the message will be: "Welcome regular user"<br>
  If the user write 2 the message will be: "Hey there special user"</p>
  
  <p>What matters is that on the code I do not want to filter by 1 or 2 but by permission</p>
  
  <p>This is the code that I have used in the first part:</p>
  
  <pre><code>Private Sub B15_Click()    
      Username.SetFocus      
      If Username = "1" Then    
          MsgBox "Welcome regular user"    
          DoCmd.Close    
      Else    
          If Username = "2" Then
              MsgBox "Hey there special user"    
          End If    
      End If    
  End Sub
  </code></pre>