Report Parameters

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

This is just a sketch. If details are needed, I will
provide them, but I don't want to litter the posting with
unnecessary information.
I havd a parameter query as the source for a report. The
report is grouped by employee name, with a separate page
for each employee. Employee name is one of the
parameters. The other is date.
I am using a combo box (cboSelectName) on a form (frmNames)
for the employee name. The row source of the combo box is
a query. The bound column is EmployeeID, which is the
primary key from the Employees table. The criteria for
EmployeeID in the query on which the report is based is
[Forms]![frmNames]![cboSelectName]. The criteria for date
is Between [Start] and [End]. That is OK as long as I
select one name and a date range, but I also would like to
select all employees within a date range. I tried making
the Or part of the criteria for Employee ID Like
[EmployeesTable]![EmployeeID] & "*", with the Or part of
the Date field the same as for the criteria. Similarly, I
made the criteria for date Like [Date] & "*". I did that
twice, once with each of the previously mentioned criteria
for EmployeeID. There is one criteria and three Or
statements.
Question: When I have a criteria change in one field
(e.g. select one employee or select all employees) and the
same criteria (date range) in both cases in another field,
do I still need the Or in the date field on both the
Criteria line and the Or line?
This is driving me nuts, because when I first put it
together it worked, but later in the day (after I had
added some records), it no longer worked. I could still
select a date range, but could not narrow it down to one
employee. Can't figure why it stopped working, or for
that matter if I need to do something different. Any
ideas? Help is, as usual, no real help.
 
You shouldn't be using ORs anywhere.

The syntax is
Where (Dait between Enddate and StartDate) AND EmployeeID
= x
For ALL employees, just leave off the last part.
 
Thanks for the reply, but I have to tell you I don't
understand it. The syntax of what? The criteria
expression? If so, in which field does the expression
go? When the Employee ID field's criteria is the value
from the combo box ([Forms]![FormContainingComboBox]!
[ComboBox]), and the date field's criteria is "Between
[Start] and [End]', it works when I select an employee and
a date range. I also need to select an employee and no
date range (i.e. all records for that employee); all
employees and a date range; and all employees and no date
range (i.e. all records for all employees).
Until now I have understood that if I want to select
criteria for two fields, I need a criteria expression in
each of the two fields.
-----Original Message-----

You shouldn't be using ORs anywhere.

The syntax is
Where (Dait between Enddate and StartDate) AND EmployeeID
= x
For ALL employees, just leave off the last part.
-----Original Message-----
This is just a sketch. If details are needed, I will
provide them, but I don't want to litter the posting with
unnecessary information.
I havd a parameter query as the source for a report. The
report is grouped by employee name, with a separate page
for each employee. Employee name is one of the
parameters. The other is date.
I am using a combo box (cboSelectName) on a form (frmNames)
for the employee name. The row source of the combo box is
a query. The bound column is EmployeeID, which is the
primary key from the Employees table. The criteria for
EmployeeID in the query on which the report is based is
[Forms]![frmNames]![cboSelectName]. The criteria for date
is Between [Start] and [End]. That is OK as long as I
select one name and a date range, but I also would like to
select all employees within a date range. I tried making
the Or part of the criteria for Employee ID Like
[EmployeesTable]![EmployeeID] & "*", with the Or part of
the Date field the same as for the criteria. Similarly, I
made the criteria for date Like [Date] & "*". I did that
twice, once with each of the previously mentioned criteria
for EmployeeID. There is one criteria and three Or
statements.
Question: When I have a criteria change in one field
(e.g. select one employee or select all employees) and the
same criteria (date range) in both cases in another field,
do I still need the Or in the date field on both the
Criteria line and the Or line?
This is driving me nuts, because when I first put it
together it worked, but later in the day (after I had
added some records), it no longer worked. I could still
select a date range, but could not narrow it down to one
employee. Can't figure why it stopped working, or for
that matter if I need to do something different. Any
ideas? Help is, as usual, no real help.
.
.
 
Back
Top