performing a lookup on a query

B

bigbore50

is it possible to perform a lookup on a query

I want to do a look that counts from lets say 1 to 10

in this loop i want to look up

x=1
loop until x=10
lookup("auditor",qry_audits, where record = x)
auditor(x) = lookup value
x = x+1
end loop


I can't figure out the exact code

PLEASE HELP !!!

Thanks you very much
 
M

Marshall Barton

is it possible to perform a lookup on a query

I want to do a look that counts from lets say 1 to 10

in this loop i want to look up

x=1
loop until x=10
lookup("auditor",qry_audits, where record = x)
auditor(x) = lookup value
x = x+1
end loop


For x = 1 To 10
auditor(x)=DLookup("auditor","qry_audits","record= "& x)
Bext x
 
B

bigbore50

Well i used this code and it says Sub or Function not defined

and i did define them as

Dim auditor1 As String
Dim auditor2 As String
Dim auditor3 As String
For x = 1 To 3
auditor(x)=DLookup("auditor","qry_audits","record= "& x)
Next x

Is this the wrong way to do it?
 
M

Marshall Barton

Well i used this code and it says Sub or Function not defined

and i did define them as

Dim auditor1 As String
Dim auditor2 As String
Dim auditor3 As String


Is this the wrong way to do it?


You are correct, that is the wrong way ;-)

Your syntax implied an array, which was the right way:

Dim astrAuditor(1 To 3) As String

This entire operation may be the wrong way to deal with
whatever it is that you want to accomplish, but I can't tell
from what you've said so far.
 
Top