Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DLookup in an IIF statement

Status
Not open for further replies.

BradCollins

Technical User
Sep 2, 2003
116
AU

I am trying to utilise the following code, I have tried a few things, but nothing seems to work.

IIf(DLookUp("[fldSiteNumber]","tblSettings")="",([tblTank_Details].[fldDepot]) Like "*",DLookUp("[fldSiteNumber]","tblSettings"))

Basically I want to restrict a search by the site number, so taht users only see their own data, and then if you are at head office show all the data.

I have tried changing :

IIf(DLookUp("[fldSiteNumber]","tblSettings")=""
to
IIf(DLookUp("[fldSiteNumber]","tblSettings")is null

and a few other things, but cannot seem to get this to work.

Any ideas would be most appreciated. Thanks
 
Doesnt matter, I have finally worked it out.

If any one is interested, the solution is:

IIf(IsNull(DLookUp("[fldSiteNumber]","tblSettings"))=True,([tblTank_Details].[fldDepot]),DLookUp("[fldSiteNumber]","tblSettings"))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top