For loop or do while?

  • Thread starter jbiggs via AccessMonster.com
  • 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.
 
J

John W. Vinson

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]
 

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