There is one problem I want to address. It is when a certain value is repeated and does not add it
Code:
Private Sub cmdExecute_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strEmployeeName As String
Dim strSpecialization As String
Dim intCounter As Integer
Dim strSQL As String
Set db = CurrentDb
Set rs = db.OpenRecordset("qryNamesWithNewSpecialization", dbOpenSnapshot)
'Make sure we have records and then
'make sure we are at the first record
If rs.RecordCount < 1 Then
MsgBox "No records require an update"
Set rs = Nothing
Set db = Nothing
Exit Sub
End If
rs.MoveFirst
rs.MoveLast
rs.MoveFirst
intCounter = rs.RecordCount
MsgBox "You are about to update " & intCounter & " records."
'We need to loop through all of the records
'that our query object found
While rs.EOF = False
strEmployeeName = rs![EmployeeName]
strSpecialization = rs![Specialization]
strSQL = "UPDATE Table2 SET Table2.Specialization = '" & strSpecialization & "' WHERE ((Table2.EmployeeName)='" & strEmployeeName & "')"
db.Execute strSQL, dbFailOnError
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Set db = Nothing
MsgBox "Complete"
End Sub