ELookup vs. DLookup

Chris Bettencou

Registered User.
Local time
Yesterday, 20:43
Joined
Dec 18, 2006
Messages
17
Hello,
I'm trying to switch from DLookup to ELookup for issues of speed only. I currently have

=DLookup("[Message]","CurrentLabels","[LabelNumber]=1")

since the fourth ordering field is supposed to be optional, I thought that I could use

=ELookup("[Message]","CurrentLabels","[LabelNumber]=1")

and get the same results. However, I only get

#Name

Does anyone know what I'm doing wrong? I'd really appreciate it.

Thanks in advance.
 
Chris

ELookup is not a MS Access command it was created by Allen Browne, I assume that you have created a module and copied the code into it?.
 
my first guess would be that you have saved the module with the same name as the function, second guess would be that you have not put it in a public module

Peter
 
Allan, I have not created a module. I suppose that I am an idiot. I've been slogging my way through this stuff, and I didn't realize that it wasn't a standard command.
Bat17, I'll be sure to name the module with the same name as the function and make it public.
Thanks to both of you for helping a moron!
 
Hi -

Do not give both the function and module the same name. It creates nothing but problems. Reread Bat17's post.

Bob
 
Allen Bowne Says That:)
DLookup() can call the expression service to resolve an argument such as:

DLookup("Surname", "Clients", "ClientID = [Forms].[Form1].[ClientID]")
You can resolve the last issue by concatenating the value into the string:
ELookup("Surname", "Clients", "ClientID = " & [Forms].[Form1].[ClientID])
 
>> DLookup() can call the expression service to resolve an argument

It can indeed - because it is an Access method, not a data access API like DAO or ADO. Just like other Access data methods, RunSQL and OpenQuery can both resolve Access expressions.
Concatenating the expression into your criteria is one option, though if you're Source/Domain parameter is using a query - which itself uses a form based parameter - then this isn't possible.

ELookup could easily be extended to handle such form references though by incorporating the standard type of querydef parameter code, for example as used in fDAOGenericRst - found in other threads, e.g. here

Cheers.
 

Users who are viewing this thread

Back
Top Bottom