Conditional DB reports

  • Thread starter Thread starter Bill Shultz
  • Start date Start date
B

Bill Shultz

I have a database that has two field, one by company and another by group
name. I sort the report by a data range, which I use a form to select the
dates, company and group. My question is how to I write an expression in a
text field when the company is null it will select or use the group name.
Currently I am getting all records even when the company field is null.

=IIf(IsNull([Form]![Report Date Range]![cboCompany])," ",[Forms]![Report
Date Range]![cboGroup])

Thanks,
 
I think there is a disconnect here. Databases have tables, queries, forms,
reports, code,... Tables and Queries have fields. Fields have names like
"Company" or "Group Name".

"Sort" is the order records are displayed. "Criteria" and "Filter" are used
to determine which records are displayed.

You don't "write an expression in a text field". You might enter an
expression into a Text Box control source. An expression in the Control
Source property of a text box on a report should generally reference the
field/columns in the report's record source.

I don't know if you are attempting to filter the records or display
something in a report text box.
 
Thanks for responding to my question. I am wanting to filter the results of
the report by using the Control Source in the text box in a report.

Duane Hookom said:
I think there is a disconnect here. Databases have tables, queries, forms,
reports, code,... Tables and Queries have fields. Fields have names like
"Company" or "Group Name".

"Sort" is the order records are displayed. "Criteria" and "Filter" are used
to determine which records are displayed.

You don't "write an expression in a text field". You might enter an
expression into a Text Box control source. An expression in the Control
Source property of a text box on a report should generally reference the
field/columns in the report's record source.

I don't know if you are attempting to filter the records or display
something in a report text box.
--
Duane Hookom
Microsoft Access MVP


Bill Shultz said:
I have a database that has two field, one by company and another by group
name. I sort the report by a data range, which I use a form to select the
dates, company and group. My question is how to I write an expression in a
text field when the company is null it will select or use the group name.
Currently I am getting all records even when the company field is null.

=IIf(IsNull([Form]![Report Date Range]![cboCompany])," ",[Forms]![Report
Date Range]![cboGroup])

Thanks,
 
You don't generally filter a report based on a control (text box) in the
report. You filter the records by creating a crteria in the Record Source of
the report or using a where condition in the code that opens the report.

--
Duane Hookom
Microsoft Access MVP


Bill Shultz said:
Thanks for responding to my question. I am wanting to filter the results of
the report by using the Control Source in the text box in a report.

Duane Hookom said:
I think there is a disconnect here. Databases have tables, queries, forms,
reports, code,... Tables and Queries have fields. Fields have names like
"Company" or "Group Name".

"Sort" is the order records are displayed. "Criteria" and "Filter" are used
to determine which records are displayed.

You don't "write an expression in a text field". You might enter an
expression into a Text Box control source. An expression in the Control
Source property of a text box on a report should generally reference the
field/columns in the report's record source.

I don't know if you are attempting to filter the records or display
something in a report text box.
--
Duane Hookom
Microsoft Access MVP


Bill Shultz said:
I have a database that has two field, one by company and another by group
name. I sort the report by a data range, which I use a form to select the
dates, company and group. My question is how to I write an expression in a
text field when the company is null it will select or use the group name.
Currently I am getting all records even when the company field is null.

=IIf(IsNull([Form]![Report Date Range]![cboCompany])," ",[Forms]![Report
Date Range]![cboGroup])

Thanks,
 
Back
Top