I've got a database in Access 97. It is a database with employee names, their employee numbers and their first day and last day worked until 1994. Then data was appended from 1994 to date. This in effect has duplicated some of the serial numbers. Now I have one employee with two records, one record has an end date of null and the other is an end date in 1994. The 1994 end date is incorrect, because the employee also has a end date of null which means, he is still working. I need to find these records and delete the 1994 record. This needs to be done for approximately 59,000 records.
The VB command that we wrote is:
Option Compare Database
Option Explicit
Private Sub Command0_Click()
On Error GoTo Err_Command0_click
Dim db As Database
Set db = CurrentDb()
Dim rs As Recordset
Set rs = db.OpenRecordset("select*from employeedatabase")
Dim intserial As Long
While Not rs.EOF
intserial = rs("serial")
If intserial = rs("serial") Then
If rs("last_work") = Not "NULL" Then
rs.Edit
rs.Delete
rs.Update
rs.MoveNext
End If
End If
Wend
Beep
Exit_command0_click:
Exit Sub
Err_Command0_click:
MsgBox Err.Description
Resume Exit_command0_click
End Sub
Private Sub Form_Click()
End Sub
------------------------------------------------------
However, when it is run, a "Type mismatch" message appears.
HELP!!! <img src=/S/confused.gif border=0 alt=confused width=15 height=20>



