M
Mrodrz
I have a form with multiple combo boxes. I need to find all records that
maches the seleted criteria (Combo boxes). The criteria runs from multiple
tables. My problem is that I cannot get it to work, so It will return only
exact matches since the user will not always select all fields. Sometimes
they will select only two fields, and it causes a problem with nulls values
from the form.
SELECT Tbl_Employee.Employee_Name, Tbl_Employee.Department,
TblEmp_Domain_Knowledge.[Domain Knowledge],
TblEmp_System_Knowledge.Emp_System_Knowledge, TblTaskForce.TForce_Name
FROM ((Tbl_Employee INNER JOIN TblEmp_Domain_Knowledge ON
Tbl_Employee.Employee_ID = TblEmp_Domain_Knowledge.Emp_ID) INNER JOIN
TblEmp_System_Knowledge ON Tbl_Employee.Employee_ID =
TblEmp_System_Knowledge.Emp_ID) INNER JOIN (TblTaskForce INNER JOIN
TblTaskForceEmployees ON TblTaskForce.TForce_Name =
TblTaskForceEmployees.TblTforceEmp_TforceName) ON Tbl_Employee.Employee_ID =
TblTaskForceEmployees.TblTforceEmp_ID
WHERE
(((Tbl_Employee.Department)=[Forms]![FrmSelectCriteria].[TxtDepartment]) AND
((TblEmp_Domain_Knowledge.[Domain Knowledge]) In
([Forms]![FrmSelectCriteria]![TxtDomain1],[Forms]![FrmSelectCriteria]![TxtDomain2],[Forms]![FrmSelectCriteria]![TxtDomain3],[Forms]![FrmSelectCriteria]![TxtDomain4]))
AND ((TblEmp_System_Knowledge.Emp_System_Knowledge) In
([Forms]![FrmSelectCriteria]![TxtSystem1],[Forms]![FrmSelectCriteria]![TxtSystem2],[Forms]![FrmSelectCriteria]![TxtSystem3],[Forms]![FrmSelectCriteria]![TxtSystem4]))
AND ((TblTaskForce.TForce_Name) In
([Forms]![FrmSelectCriteria]![Tforce1],[Forms]![FrmSelectCriteria]![Tforce2],[Forms]![FrmSelectCriteria]![Tforce3],[Forms]![FrmSelectCriteria]![Tforce4])));
How can I avoid null text boxes in the form? Or how to refer to if not null
in the select statement?
maches the seleted criteria (Combo boxes). The criteria runs from multiple
tables. My problem is that I cannot get it to work, so It will return only
exact matches since the user will not always select all fields. Sometimes
they will select only two fields, and it causes a problem with nulls values
from the form.
SELECT Tbl_Employee.Employee_Name, Tbl_Employee.Department,
TblEmp_Domain_Knowledge.[Domain Knowledge],
TblEmp_System_Knowledge.Emp_System_Knowledge, TblTaskForce.TForce_Name
FROM ((Tbl_Employee INNER JOIN TblEmp_Domain_Knowledge ON
Tbl_Employee.Employee_ID = TblEmp_Domain_Knowledge.Emp_ID) INNER JOIN
TblEmp_System_Knowledge ON Tbl_Employee.Employee_ID =
TblEmp_System_Knowledge.Emp_ID) INNER JOIN (TblTaskForce INNER JOIN
TblTaskForceEmployees ON TblTaskForce.TForce_Name =
TblTaskForceEmployees.TblTforceEmp_TforceName) ON Tbl_Employee.Employee_ID =
TblTaskForceEmployees.TblTforceEmp_ID
WHERE
(((Tbl_Employee.Department)=[Forms]![FrmSelectCriteria].[TxtDepartment]) AND
((TblEmp_Domain_Knowledge.[Domain Knowledge]) In
([Forms]![FrmSelectCriteria]![TxtDomain1],[Forms]![FrmSelectCriteria]![TxtDomain2],[Forms]![FrmSelectCriteria]![TxtDomain3],[Forms]![FrmSelectCriteria]![TxtDomain4]))
AND ((TblEmp_System_Knowledge.Emp_System_Knowledge) In
([Forms]![FrmSelectCriteria]![TxtSystem1],[Forms]![FrmSelectCriteria]![TxtSystem2],[Forms]![FrmSelectCriteria]![TxtSystem3],[Forms]![FrmSelectCriteria]![TxtSystem4]))
AND ((TblTaskForce.TForce_Name) In
([Forms]![FrmSelectCriteria]![Tforce1],[Forms]![FrmSelectCriteria]![Tforce2],[Forms]![FrmSelectCriteria]![Tforce3],[Forms]![FrmSelectCriteria]![Tforce4])));
How can I avoid null text boxes in the form? Or how to refer to if not null
in the select statement?