Z
zz
I've coded a somewhat complex conversion program. Its creating a table based
on the contents of another table. I'm creating an artificial key composed of
name and phone number that must be unique.
Before I add records to the target recordset I need to issue a find command
on the previoulsy added records to see if it is a duplicate. Sometimes this
works and sometimes it does not. I think it may be failing only when the
immediately preceding record is the duplicate. Here is the skeleton of my
code, any ideas?
While Not rs1.EOF
' Form artificial key
strCID = strULN & Left$(strUFN, 1) & Right$(strTel, 4)
' Check if already exists
If Not rs2.BOF Then
rs2.Find "ClientCode = '" & Replace(strCID, "'", "''") & "'", ,
adSearchBackward
End If
If rs2.BOF Then
If Not rs2.EOF Then
rs2.MoveLast
End If
rs2.AddNew
......
rs2.Update
Else
rs2.MoveLast
End If
rs1.MoveNext
Wend
on the contents of another table. I'm creating an artificial key composed of
name and phone number that must be unique.
Before I add records to the target recordset I need to issue a find command
on the previoulsy added records to see if it is a duplicate. Sometimes this
works and sometimes it does not. I think it may be failing only when the
immediately preceding record is the duplicate. Here is the skeleton of my
code, any ideas?
While Not rs1.EOF
' Form artificial key
strCID = strULN & Left$(strUFN, 1) & Right$(strTel, 4)
' Check if already exists
If Not rs2.BOF Then
rs2.Find "ClientCode = '" & Replace(strCID, "'", "''") & "'", ,
adSearchBackward
End If
If rs2.BOF Then
If Not rs2.EOF Then
rs2.MoveLast
End If
rs2.AddNew
......
rs2.Update
Else
rs2.MoveLast
End If
rs1.MoveNext
Wend