K
Kindra
Hi,
I'm new here and I'm trying to write a "search" query (I
work in a library) that will allow me to search by date,
title, and department (or any combination thereof). I
have created a form that will allow a user to search by
these different parameters.
Here's my SQL:
SELECT qryOrdersAll.*
FROM qryOrdersAll
WHERE (((qryOrdersAll.DEPT)=[Forms]!
[frmTechServicesOrdering]![txtDeptTest]) AND
((qryOrdersAll.ORDER_DATE) Between [Forms]!
[frmTechServicesOrdering]![txtStartDate] And [Forms]!
[frmTechServicesOrdering]![txtEndDate])) OR
(((qryOrdersAll.ORDER_DATE) Between [Forms]!
[frmTechServicesOrdering]![txtStartDate] And [Forms]!
[frmTechServicesOrdering]![txtEndDate]) AND
((qryOrdersAll.TITLE) Like "*" & [Forms]!
[frmTechServicesOrdering]![txtTitleSearch] & "*"));
It's searching by date and title just fine, but when I try
to search by date and department, it finds all of the
records. I am passing the department ID number, which is
the DEPT field. The DEPT field is a text field.
Can anyone help?
Thanks,
Kindra
I'm new here and I'm trying to write a "search" query (I
work in a library) that will allow me to search by date,
title, and department (or any combination thereof). I
have created a form that will allow a user to search by
these different parameters.
Here's my SQL:
SELECT qryOrdersAll.*
FROM qryOrdersAll
WHERE (((qryOrdersAll.DEPT)=[Forms]!
[frmTechServicesOrdering]![txtDeptTest]) AND
((qryOrdersAll.ORDER_DATE) Between [Forms]!
[frmTechServicesOrdering]![txtStartDate] And [Forms]!
[frmTechServicesOrdering]![txtEndDate])) OR
(((qryOrdersAll.ORDER_DATE) Between [Forms]!
[frmTechServicesOrdering]![txtStartDate] And [Forms]!
[frmTechServicesOrdering]![txtEndDate]) AND
((qryOrdersAll.TITLE) Like "*" & [Forms]!
[frmTechServicesOrdering]![txtTitleSearch] & "*"));
It's searching by date and title just fine, but when I try
to search by date and department, it finds all of the
records. I am passing the department ID number, which is
the DEPT field. The DEPT field is a text field.
Can anyone help?
Thanks,
Kindra