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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf Statment with Is Not Null not working 1

Status
Not open for further replies.

hartwell

Technical User
Apr 18, 2005
80
GB
Hi Guy's

Could anyone shed any light on why this would not work? If I put in a string which i know exsits replacing "Is not null" it works but is not null just wont work...

If the PC username = Hartwei then bring back everything which isnt null else bring back my record only

IIf(Environ("Username")="hartwei",Is Not Null,Environ("Username"))
 
SELECT tblUsers.RACFID
FROM tblUsers
WHERE (((tblUsers.RACFID)=IIf(Environ("Username")="hartwei",(tblUsers.RACFID) Is Not Null,Environ("Username"))));
 
Code:
WHERE IIf(Environ("Username") = "hartwei",
          tblUsers.RACFID Is Not Null,
          tblUsers.RACFID=Environ("Username")
 
SELECT RACFID
FROM tblUsers
WHERE RACFID = IIf(Environ("Username")="hartwei"
,RACFID,Environ("Username"))

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top