IIF QUESTION FOR QUERIES

Z

ZigZagZak

I can't figure out the proper syntax for this.

SELECT EMPLOYEES.EMPLOYEE, EMPLOYEES.BRANCH
FROM EMPLOYEES
WHERE (((IIf((EMPLOYEES.BRANCH) Is Null,EMPLOYEES.BRANCH Like
"*",(EMPLOYEES.BRANCH)=Forms![REBORE INQUIRY]!BRANCH))<>False));

I have a couple combo boxes on a form. One for "branch" and one for
"employee"
I want the employee combo box to show the possible employee's at the branch
a user chooses, however if they don't choose a branch I want it to show all
employee's names. help?

Thanks in advance.

Zach
 
D

Dale Fye

Try this:

SELECT EMPLOYEES.EMPLOYEE, EMPLOYEES.BRANCH
FROM EMPLOYEES
WHERE Forms![REBORE INQUIRY]!BRANCH IS NULL
OR Forms![REBORE INQUIRY]!BRANCH = Employees.Branch

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Z

ZigZagZak

That worked beautifully. Thanks!

Dale Fye said:
Try this:

SELECT EMPLOYEES.EMPLOYEE, EMPLOYEES.BRANCH
FROM EMPLOYEES
WHERE Forms![REBORE INQUIRY]!BRANCH IS NULL
OR Forms![REBORE INQUIRY]!BRANCH = Employees.Branch

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



ZigZagZak said:
I can't figure out the proper syntax for this.

SELECT EMPLOYEES.EMPLOYEE, EMPLOYEES.BRANCH
FROM EMPLOYEES
WHERE (((IIf((EMPLOYEES.BRANCH) Is Null,EMPLOYEES.BRANCH Like
"*",(EMPLOYEES.BRANCH)=Forms![REBORE INQUIRY]!BRANCH))<>False));

I have a couple combo boxes on a form. One for "branch" and one for
"employee"
I want the employee combo box to show the possible employee's at the branch
a user chooses, however if they don't choose a branch I want it to show all
employee's names. help?

Thanks in advance.

Zach
 
M

Marshall Barton

ZigZagZak said:
I can't figure out the proper syntax for this.

SELECT EMPLOYEES.EMPLOYEE, EMPLOYEES.BRANCH
FROM EMPLOYEES
WHERE (((IIf((EMPLOYEES.BRANCH) Is Null,EMPLOYEES.BRANCH Like
"*",(EMPLOYEES.BRANCH)=Forms![REBORE INQUIRY]!BRANCH))<>False));

I have a couple combo boxes on a form. One for "branch" and one for
"employee"
I want the employee combo box to show the possible employee's at the branch
a user chooses, however if they don't choose a branch I want it to show all
employee's names. help?


WHERE BRANCH=Forms![REBORE INQUIRY]!BRANCH
Or Forms![REBORE INQUIRY]!BRANCH Is Null
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top