F
Fury
Hi, i wrote the following code(reduced to my Problem):
---------------------------------------------------------------
Dim dbs As Database
Set dbs = CurrentDb
Set quelle = dbs.OpenRecordset("Projektverfolgung")
Set ziel = dbs.OpenRecordset("Ansprechpartner")
quelle.MoveFirst
ziel.MoveFirst
i = 0
Do While Not quelle.EOF
Do While Not ziel.EOF
X = X + 1
if quelle!Ansprechpartner = ziel!Name Then i = i + 1
ziel.MoveNext
Loop
Debug.Print "outside!"
quelle.MoveNext
r = r + 1
loop
MsgBox i & " found " & X & " Iterations: " & r
---------------------------------------------------------------------
I really don't understand why this code doesn't just move through the
ziel Recordset
and then steps to the next quelle Recordset to make the comparison
work,
what happens is that the inner Loop works, but the outer Loop doesn't
work, i get a bunch of outside! Output after the inner Loop and than
the routine ends, i even tried it the following way , which produces
the same result:
---------------------------------------------------------------
Dim dbs As Database
Set dbs = CurrentDb
Set quelle = dbs.OpenRecordset("Projektverfolgung")
Set ziel = dbs.OpenRecordset("Ansprechpartner")
quelle.MoveFirst
ziel.MoveFirst
i = 0
for a = 1 to 1638 'Number of Datas
Do While Not ziel.EOF
X = X + 1
if quelle!Ansprechpartner = ziel!Name Then i = i + 1
ziel.MoveNext
Loop
Debug.Print "outside!"
quelle.MoveNext
r = r + 1
next a
MsgBox i & " found " & X & " Iterations: " & r
---------------------------------------------------------------
Dim dbs As Database
Set dbs = CurrentDb
Set quelle = dbs.OpenRecordset("Projektverfolgung")
Set ziel = dbs.OpenRecordset("Ansprechpartner")
quelle.MoveFirst
ziel.MoveFirst
i = 0
Do While Not quelle.EOF
Do While Not ziel.EOF
X = X + 1
if quelle!Ansprechpartner = ziel!Name Then i = i + 1
ziel.MoveNext
Loop
Debug.Print "outside!"
quelle.MoveNext
r = r + 1
loop
MsgBox i & " found " & X & " Iterations: " & r
---------------------------------------------------------------------
I really don't understand why this code doesn't just move through the
ziel Recordset
and then steps to the next quelle Recordset to make the comparison
work,
what happens is that the inner Loop works, but the outer Loop doesn't
work, i get a bunch of outside! Output after the inner Loop and than
the routine ends, i even tried it the following way , which produces
the same result:
---------------------------------------------------------------
Dim dbs As Database
Set dbs = CurrentDb
Set quelle = dbs.OpenRecordset("Projektverfolgung")
Set ziel = dbs.OpenRecordset("Ansprechpartner")
quelle.MoveFirst
ziel.MoveFirst
i = 0
for a = 1 to 1638 'Number of Datas
Do While Not ziel.EOF
X = X + 1
if quelle!Ansprechpartner = ziel!Name Then i = i + 1
ziel.MoveNext
Loop
Debug.Print "outside!"
quelle.MoveNext
r = r + 1
next a
MsgBox i & " found " & X & " Iterations: " & r