Help with multiple criteria query

J

Jason M

I am using the following SQL in a query from a form to open a second form in
the after update event of the respective combo boxes, however the form will
only open if one or the other criteria are in the query but not both!
I think the problem is in the query and not the form load event. Can some
one here please take a look ang give me a bit of assistance:

SELECT tblEmployees.*, tblEmployees.Department, tblEmployees.employeeID
FROM tblEmployees
WHERE
(((tblEmployees.Department)=[forms].[frmEditEmployees].[cboDepartment].[valu
e])) OR
(((tblEmployees.employeeID)=[forms].[frmeditemployees].[cboemployeename].[va
lue]));

Only one or the other combo boxes would be used to navigate to a record or
group of records in the data base. I thought this would be the easiest way
to get this job done, but perhaps I was wrong!!!
Thanks in advance for any assistance that you can offer.

Jason M Canady
(e-mail address removed)
 
M

Michel Walsh

Hi,

If you want the records where only one of the condition is applied, not
both, use XOR instead of OR:


WHERE Department=FORMS!frmEditEmployees.cboDepartment
XOR EmployeeID=FORMS!frmEditEmployees.cboEmployeeName



Hoping it may help,
Vanderghast, Access MVP
 
J

Jason M

Thanks! I was getting a bit frustrated with this one! I will give this a
try.

Thanks again.
Jason
Michel Walsh said:
Hi,

If you want the records where only one of the condition is applied, not
both, use XOR instead of OR:


WHERE Department=FORMS!frmEditEmployees.cboDepartment
XOR EmployeeID=FORMS!frmEditEmployees.cboEmployeeName



Hoping it may help,
Vanderghast, Access MVP



Jason M said:
I am using the following SQL in a query from a form to open a second
form
in
the after update event of the respective combo boxes, however the form will
only open if one or the other criteria are in the query but not both!
I think the problem is in the query and not the form load event. Can some
one here please take a look ang give me a bit of assistance:

SELECT tblEmployees.*, tblEmployees.Department, tblEmployees.employeeID
FROM tblEmployees
WHERE
(((tblEmployees.Department)=[forms].[frmEditEmployees].[cboDepartment].[valu
(((tblEmployees.employeeID)=[forms].[frmeditemployees].[cboemployeename].[va
lue]));

Only one or the other combo boxes would be used to navigate to a record or
group of records in the data base. I thought this would be the easiest way
to get this job done, but perhaps I was wrong!!!
Thanks in advance for any assistance that you can offer.

Jason M Canady
(e-mail address removed)
 

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