ok this was a complete disaster. I tried just running the queries given, and had to kill them after they were running for over 18 hours. I decided to create a form with a label, and a command button. The code behind this form Created my results in less than an hour. I am posting my code here incase anybody else has a similar problem. Just a note before hand, my sim_mfr_no is a 6 digit number, that I sotred as a string, because it may have a leading zero.
/code
Private Sub cmdDoStuff_Click()
Dim rcdDup As Recordset
Dim lngIndex As Long
Dim strSql As String
Dim arrData() As String * 30
Dim I As Long
Dim T As Integer
Dim bolImpNext As Boolean
DoCmd.SetWarnings False
For T = 0 To 9
DoEvents
lblNum.Caption = T
bolImpNext = False
strSql = "select * from tblDupBob Where sim_mfr_no Like '" & T & "*' ORDER BY tblDupBob.sim_mfr_no, tblDupBob.catalog_no"
Set rcdDup = CurrentDb.OpenRecordset(strSql)
DoEvents
If rcdDup.RecordCount > 0 Then
rcdDup.MoveLast
lngIndex = rcdDup.RecordCount
ReDim arrData(4, lngIndex) As String * 30
rcdDup.MoveFirst
For I = 1 To lngIndex
arrData(1, I) = rcdDup!sim_mfr_no
arrData(2, I) = rcdDup!catalog_no
arrData(3, I) = rcdDup!mfr_obsolete_code
arrData(4, I) = rcdDup!sim_item_no
While InStrRev(arrData(2, I), "'")
DoEvents
arrData(2, I) = Mid(arrData(2, I), 1, (InStrRev(arrData(2, I), "'") - 1)) & Mid(arrData(2, I), (InStrRev(arrData(2, I), "'") + 1))
Wend
While InStrRev(arrData(2, I), Chr(34))
arrData(2, I) = Mid(arrData(2, I), 1, (InStrRev(arrData(2, I), Chr(34)) - 1)) & Mid(arrData(2, I), (InStrRev(arrData(2, I), Chr(34)) + 1))
Wend
rcdDup.MoveNext
Next I
For I = 1 To lngIndex
If I < lngIndex Then
If (arrData(1, I) = arrData(1, I + 1) And arrData(2, I) = arrData(2, I + 1)) Or bolImpNext Then
strSql = "insert into tblDup (sim_mfr_no, catalog_no, mfr_obsolete_code, sim_item_no) " & _
"select '" & arrData(1, I) & "','" & arrData(2, I) & "','" & arrData(3, I) & "','" & arrData(4, I) & "'"
DoCmd.RunSQL (strSql)
If Not bolImpNext Then
bolImpNext = True
Else
bolImpNext = False
End If
Else
bolImpNext = False
End If
ElseIf bolImpNext And I = lngIndex Then
strSql = "insert into tbldup (sim_mfr_no, catalog_no, mfr_obsolete_code, sim_item_no) " & _
"select '" & arrData(1, I) & "','" & arrData(2, I) & "','" & arrData(3, I) & "','" & arrData(4, I) & "'"
DoCmd.RunSQL (strSql)
End If
Next I
End If
rcdDup.Close
Next T
MsgBox "done"
End Sub
/code
If you have any question, please feel free to let me know. And thank you all for all your help. It is VERY much appriciated.