DLookup with criteria = User input from Like()?

eepok

Noob. Well, mostly noob.
Local time
Today, 11:56
Joined
Oct 30, 2007
Messages
112
I seem to have run into a snag. I'm pretty sure this would work otherwise:

DLookup(iif(Left( [GenericFieldname1], 4) = "C101","Offered","NOT OFFERED"),"Generic Query")

When I added this field/function to the query, I got #error values and when I clicked on one, I got an error that said:

The expression you entered as a query parameter produced this error:The object doesn't contain the automation object 'Please Enter Year'.'

I assume the problem is that I have the user filter the report by use of the Like() function for [Year] in the query when the report is accessed. How do I tell the DLookup function to search the column as filtered by the Like() function?
 
DLookup(iif(Left( [GenericFieldname1], 4) = "C101","Offered","NOT OFFERED"),"Generic Query")
I have no idea what this is trying to tell me. Maybe you could get some help if you offered more explanation in "English" of what you want from writing the above SQL (I assume the SQL is in a query?).

The syntax is not right anyway, but to answer any question that you have about it, a detailed explanation for each separate part of the function (at least) is needed. The one thing noticeable right away, is the IIF function not complying with the DLookup syntax. If it would work at all, the format of the IIF statement should look like...
Code:
DLookup("[iif(Left( [GenericFieldname1], 4) = "C101",
   "Offered","NOT OFFERED")]","Generic Query")
 

Users who are viewing this thread

Back
Top Bottom