title: Returning a single record from a table Visual Basic
body: <p>This post is somewhat similar to a previous post of mine on how to return multiple records from a table. However, here I would like to return just one record from a table. Here's what I have tried:</p>
  
  <pre><code>Private Sub UpdateSalary(RoleSelected As String)
  
  Dim strSQL As String
  strSQL = "SELECT Salary " &amp; _
           "FROM Roles_Table " &amp; _
           "WHERE Role = '" &amp; RoleSelected &amp; "'; "
  
  Dim rcrd As Record
  Dim salaryValue As Integer
  
  'Get the values of the SQL from the data base
  Set rcrd = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
  
  End Sub
  </code></pre>
  
  <p>The basic logic behind this is that when the user selects a value in the combo box it should update the textbox according to that selection. The combo box contains values from a table called Roles, which holds role definition and attributed salary for that role.</p>
  
  <p>For example - say accountant head is selected, then the textbox for salary should examine the table and get the salary associated with that role. 
  I believe my SQL is fine, it's just how to get the value from the record which I'm stuck at.</p>
  
  <p>Thanks </p>