For loop or do while?

  • Thread starter Thread starter jbiggs via AccessMonster.com
  • Start date Start date
J

jbiggs via AccessMonster.com

Sample of code I am trying to re-write recursively:

d1 = DLookup("[id]", "table")
d2 = DLookup("[id]", "table", "[id]<>" & d1)
d3 = DLookup("[id]", "table", "[id]<>" & d1 & " and [id]<>" & d2)

This function currently goes to d15, which as you can imagine is very long.
I am confused on how to do the checks recursively and haven't been able to
get the code right.
 
Sample of code I am trying to re-write recursively:

d1 = DLookup("[id]", "table")
d2 = DLookup("[id]", "table", "[id]<>" & d1)
d3 = DLookup("[id]", "table", "[id]<>" & d1 & " and [id]<>" & d2)

This function currently goes to d15, which as you can imagine is very long.
I am confused on how to do the checks recursively and haven't been able to
get the code right.

What exactly are you trying to ACCOMPLISH? I'm sure that DLookUp is going to
be very inefficient at this... and a "frustrated outer join" query may be much
better, but I'm not getting what the purpose of this entire endeavour might
be!

John W. Vinson [MVP]
 
Back
Top