Hi, I have a form which is fed by a query. The query gets info from tblworders, the query has multiple criteria that is specified in the text boxes on the form.
Wodate - From and to date
Department
Week
Year
job type
status
All of the above are specified in the form, my problem is if I just want to filter by date (or filter by only one and leave the other text boxes blank there are no results returned even though there should be.
On the query design, if I delete all of the criteria other than the wodate, it will filter by date and return result but as soon as I put in the other criteria it will not bring anything through.
Any reason for this, I thought a query could be filtered by multiple criteria
Thanks
Heres the sql code:
SELECT TblWOrders.WONum, TblWOrders.WODate, TblWOrders.CompBy, TblWOrders.WOtime, TblWOrders.department, TblWOrders.description, TblWOrders.site, TblWOrders.type, TblWOrders.Reason, TblWOrders.person, TblWOrders.JobType, TblWOrders.status, TblWOrders.Signoff, TblWOrders.SOdate, TblWOrders.SOtime, TblWOrders.SOcomments, TblWOrders.week, TblWOrders.pyear, TblWOrders.assetcattop, TblWOrders.risk, TblWOrders.tracker, TblWOrders.ResponsiblePerson, TblWOrders.printed, TblWOrders.plannedmaintadded, TblAssets.Desc
FROM TblAssets INNER JOIN TblWOrders ON TblAssets.AssetNum = TblWOrders.description
WHERE (((TblWOrders.WODate) Between [FROM DATE] And [TO DATE]) AND ((TblWOrders.department)=[forms]![frmwostatusfilter].[department]) AND ((TblWOrders.JobType)=[forms]![frmwostatusfilter].[jobtype]) AND ((TblWOrders.status)=[forms]![frmwostatusfilter].[status]) AND ((TblWOrders.week)=[forms]![frmwostatusfilter].[wweek]) AND ((TblWOrders.pyear)=[forms]![frmwostatusfilter].[wyear]));