title: Loops through Access column and find duplicates
body: <p>I have a form in MS Access for adding new records and I am trying to create VBA code which to be triggered After Update of the Form. What I am trying to do is to loop through a column in a table linked to the Form and to check if the added value is in the column already, if yes update another column called"duplicate" for all duplicate records to "yes".</p>
  
  <p>For example if the user add "Mike Down" and there is already a record with this name in the table, column "duplicate" for all records with this name to be updated to "yes".
  I am totally new to VBA access and so far I only found how to do the loop:</p>
  
  <pre><code>Dim dbsMyDB As DAO.Database
  Dim rstMyTable As DAO.Recordset
  Dim frmForm As Form
  intI = 1
  With rstMyDB
      Do Until .EOF
      Loop
          If rstMyTable.Name = frmForm.Name Then
          .Edit
          --update column duplicate to "yes" for all duplicates
          .Update
          .MoveNext
          intI = intI + 1
  End With
  </code></pre>