Comparing data

J

jonathan.behr

Dim i As Long
Dim j As Long

Dim cnn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim strSql1 As String
Dim lngRecordCount1 As Long
Dim lngParseID As Long
Dim strMsg As String
Dim lngTime1 As Long
Dim strDataSource1 As String
Dim strDataSource2 As String
Dim lngCurrRecord As Long
Dim CurrTime As Long

Dim varArray

CurrTime = Time()
'Recordset to retrieve the combat log
Set cnn = CurrentProject.Connection
Set rs1 = New ADODB.Recordset

strSql1 = "Select ParseID, lngTime, strDataSource, strMsg,
lngParseID from tblParsedData ORDER BY lngTime ASC"

rs1.Open strSql1, cnn, adOpenKeyset, adLockOptimistic


varArray = rs1.GetRows
lngRecordCount1 = rs1.RecordCount

lngRecordCount1 = rs1.RecordCount - 1

strDataSource1 = "Mike"
strDataSource2 = "Steve"

For i = 0 To lngRecordCount1


If Not IsNull(varArray(4, i)) Then 'Looks to see if we have
matched it yet
'Do nothing as its aleady been matched, so move onto next
i
Else
If varArray(2, i) = strDataSource1 Then
strMsg = varArray(3, i)
lngParseID = varArray(0, i)
lngTime1 = varArray(1, i)
For j = lngCurrRecord To lngRecordCount1
If (varArray(1, j) - lngTime1) > 30000 Then '>30
seconds, stop looking for a match
Exit For
Else
If IsNull(varArray(4, j)) Then 'Looks to see
if we have matched it yet
If varArray(2, j) = strDataSource2 Then
If varArray(3, j) = strMsg Then
varArray(4, j) = lngParseID
varArray(4, i) = varArray(0, j)
lngCurrRecord = j
Exit For
End If
End If
End If
End If
Next
End If

End If


Next i

Debug.Print Time() - CurrTime
 
J

John W. Vinson

Dim i As Long
Dim j As Long

Dim cnn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim strSql1 As String

Do you have a question, Jonathan?

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top