title: Access Primary Key usage/role
body: <p>My question is in relation to connecting a VB.net project to an Access DB. 
  Must I have a primary key in my table, or have is there a way to alter my code to not look for a PK?</p>
  
  <p>I have an error popping up telling me that I have no primary key. Now if i make "AdminID" my primary key, the system works. I was just questioning as to whether or not this is required?</p>
  
  <p>Currently my combobox displays "AdminID" where as I would rather it display "AdminName"</p>
  
  <p>Thanks.</p>
  
  <pre><code>Dim objConnection As New   OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= InfoSystem.accdb")
  Dim objAdminDA As New OleDb.OleDbDataAdapter("Select *from tblAdmins", objConnection)
  Dim objAdminCB As New OleDb.OleDbCommandBuilder(objAdminDA)
  Dim objDataSet As New DataSet()
  
  Public Sub Retrieve()
  
      'Clears DataSet of any existing data
      objDataSet.Clear()
      'Fills schema - adds table structure information to DataSet
      objAdminDA.FillSchema(objDataSet, SchemaType.Source, "tblAdmins")
      'Fills DataSet with info from the DataAdapter
      objAdminDA.Fill(objDataSet, "tblAdmins")
  
      'Fill the DataSet with info from the Admin table
      objAdminDA.FillSchema(objDataSet, SchemaType.Source, "tblAdmins")
      objAdminDA.Fill(objDataSet, "tblAdmins")
  
      'Empty combo box
      cboxAdmin.Items.Clear()
  
      'Loop through each row, adding the AdminName to the combo box
      Dim i As Integer, strAdminID As String
      For i = 1 To objDataSet.Tables("tblAdmins").Rows.Count
          strAdminID = objDataSet.Tables("tblAdmins").Rows(i - 1).Item("AdminID")
          cboxAdmin.Items.Add(strAdminID)
      Next
      'Select first item in the list
      cboxAdmin.SelectedIndex = 0
  
      FillAdminDetails()
  
  End Sub
  
  Public Sub FillAdminDetails()
      Dim objRow As DataRow
      objRow = objDataSet.Tables("tblAdmins").Rows.Find(cboxAdmin.SelectedItem.ToString)
      txtStaffDept.Text = objRow.Item("Department")
      txtStaffTitle.Text = objRow.Item("Title")
  End Sub
  
  Private Sub cboxAdmin_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboxAdmin.SelectedIndexChanged
      FillAdminDetails()
  End Sub
  
  End Sub
  </code></pre>