Help with multiple criteria query

  • Thread starter Thread starter Jason M
  • Start date Start date
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)
 
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
 
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)
 
Back
Top