P
Pete
Background
I have a report that uses a combo box to filter the data. The user can
choose ‘All Reports’, ‘Blank’ (i.e. field has not been filled in), or choose
a specific Report. The query used to populate the combo is shown below with
an example of the data it returns. (Note: I use ANSI 92 syntax in
anticipation of a move to SQL Server)
SELECT "%" as iReportID, 0 as SortOrder, "(All Reports)" as cReport FROM
tlkpReport UNION SELECT "0" as iReportID, 0 as SortOrder, "(Blank)" as
cReport FROM tlkpReport UNION SELECT tlkpReport.iReportID,
IIf(IsNull([nSortOrder]),99,[nSortOrder]) AS SortOrder, tlkpReport.cReport
FROM tlkpReport ORDER BY SortOrder, cReport;
iReportID SortOrder cReport
% 0 (All Reports)
0 0 (Blank)
1 1 Draft rep
2 2 Final rep
3 3 etc...
The relevant part of the WHERE clause in my report record source query is
shown below:
WHERE nz([tblStudy_Report].[iReportID],0) ALike
[Forms]![frmMyForm]![cboReport]
The above works fine.
Problem
However I have now been asked to add another option to the Report filter
combo “Draft and Final Reportsâ€.
It is straightforward enough to UNION another row into the combo record
source but, despite trying lots of different permutations have so far been
unable to find a combination of ‘iReportID’ value/Report Filter that will
work in every scenario (e.g. Can get ‘Draft and Final Report’ or selecting a
specific report to work, but ‘All’ does not).
Any help appreciated
Peter
I have a report that uses a combo box to filter the data. The user can
choose ‘All Reports’, ‘Blank’ (i.e. field has not been filled in), or choose
a specific Report. The query used to populate the combo is shown below with
an example of the data it returns. (Note: I use ANSI 92 syntax in
anticipation of a move to SQL Server)
SELECT "%" as iReportID, 0 as SortOrder, "(All Reports)" as cReport FROM
tlkpReport UNION SELECT "0" as iReportID, 0 as SortOrder, "(Blank)" as
cReport FROM tlkpReport UNION SELECT tlkpReport.iReportID,
IIf(IsNull([nSortOrder]),99,[nSortOrder]) AS SortOrder, tlkpReport.cReport
FROM tlkpReport ORDER BY SortOrder, cReport;
iReportID SortOrder cReport
% 0 (All Reports)
0 0 (Blank)
1 1 Draft rep
2 2 Final rep
3 3 etc...
The relevant part of the WHERE clause in my report record source query is
shown below:
WHERE nz([tblStudy_Report].[iReportID],0) ALike
[Forms]![frmMyForm]![cboReport]
The above works fine.
Problem
However I have now been asked to add another option to the Report filter
combo “Draft and Final Reportsâ€.
It is straightforward enough to UNION another row into the combo record
source but, despite trying lots of different permutations have so far been
unable to find a combination of ‘iReportID’ value/Report Filter that will
work in every scenario (e.g. Can get ‘Draft and Final Report’ or selecting a
specific report to work, but ‘All’ does not).
Any help appreciated
Peter