Need Help with IIF Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have used the query build of the Row Source of a form to have only the
current user information displayed when they open the Form. I would like to
add a IIf stament that will display all the records if the supervisor or
manger opens the Form, this is possible if how I hope someone will give me
some help on write the statement. Here is the SQl from the query.
SELECT tblx_contact.fullname AS Name, [x_Daily Research Comp].* AS
Employee1, [x_Daily Research Comp].Employee AS 1
FROM tblx_contact INNER JOIN [x_Daily Research Comp] ON
tblx_contact.strEmpName = [x_Daily Research Comp].Employee
WHERE ((([x_Daily Research Comp].Employee)=Environ("UserName")));

Thanks in advance
 
Try this:

SELECT tblx_contact.fullname AS Name, [x_Daily Research Comp].* AS
Employee1, [x_Daily Research Comp].Employee AS 1
FROM tblx_contact INNER JOIN [x_Daily Research Comp] ON
tblx_contact.strEmpName = [x_Daily Research Comp].Employee
WHERE [x_Daily Research Comp].Employee LIKE
IIF(Environ("UserName")="Admin","*",Environ("UserName"))

- Raoul
 
Raoul.. Thanks!!

JaRa said:
Try this:

SELECT tblx_contact.fullname AS Name, [x_Daily Research Comp].* AS
Employee1, [x_Daily Research Comp].Employee AS 1
FROM tblx_contact INNER JOIN [x_Daily Research Comp] ON
tblx_contact.strEmpName = [x_Daily Research Comp].Employee
WHERE [x_Daily Research Comp].Employee LIKE
IIF(Environ("UserName")="Admin","*",Environ("UserName"))

- Raoul


Raj said:
I have used the query build of the Row Source of a form to have only the
current user information displayed when they open the Form. I would like to
add a IIf stament that will display all the records if the supervisor or
manger opens the Form, this is possible if how I hope someone will give me
some help on write the statement. Here is the SQl from the query.
SELECT tblx_contact.fullname AS Name, [x_Daily Research Comp].* AS
Employee1, [x_Daily Research Comp].Employee AS 1
FROM tblx_contact INNER JOIN [x_Daily Research Comp] ON
tblx_contact.strEmpName = [x_Daily Research Comp].Employee
WHERE ((([x_Daily Research Comp].Employee)=Environ("UserName")));

Thanks in advance
 
Back
Top