Hello,
I have a form with text/combo boxes that draws from a query and sends records to a report.
The query has the following code in the criteria block of some of the columns:
[Forms]![frmName]![fldName]
This code tells the query to select only those records that match what was entered or selected in the pertinent text/combo box in the "report" form. So the SQL appears as follows:
SELECT tbl.fld1, tbl1.fld2, tbl1.fld3, tbl1.fld4
FROM tbl1
WHERE (((tbl1.fld1)=[Forms]![frmName]![fld1]) AND ((tbl1.fld2)=[Forms]![frmName]![fld2]))
So when I hit the report button. Only those records matching the search criteria set in the form appear in the report.
Sometimes I want to search by fld1 & fld2, and sometimes I want to search only by fld1 or only by fld2. Thus I leave the other tbo/cbo blank.
The problem with that is Access responds to the empty cbo/tbo as "Select all where fld is empty" rather than how I want it to - "Select All since cbo/tbo is empty".
Is there an if (or other) statement I can write into the query to tell it that if it comes across an empty tbo/cbo, "Select All" in that column?
I have a form with text/combo boxes that draws from a query and sends records to a report.
The query has the following code in the criteria block of some of the columns:
[Forms]![frmName]![fldName]
This code tells the query to select only those records that match what was entered or selected in the pertinent text/combo box in the "report" form. So the SQL appears as follows:
SELECT tbl.fld1, tbl1.fld2, tbl1.fld3, tbl1.fld4
FROM tbl1
WHERE (((tbl1.fld1)=[Forms]![frmName]![fld1]) AND ((tbl1.fld2)=[Forms]![frmName]![fld2]))
So when I hit the report button. Only those records matching the search criteria set in the form appear in the report.
Sometimes I want to search by fld1 & fld2, and sometimes I want to search only by fld1 or only by fld2. Thus I leave the other tbo/cbo blank.
The problem with that is Access responds to the empty cbo/tbo as "Select all where fld is empty" rather than how I want it to - "Select All since cbo/tbo is empty".
Is there an if (or other) statement I can write into the query to tell it that if it comes across an empty tbo/cbo, "Select All" in that column?
Comment