Combo Box sort for Report

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

On my reports form I've got a report where you can select
from a combo box which company you want to print
information. Once selected, the page header of the report
has a text field that will display whichever company I
selected: control source is [Forms]![reportformname]!
[comboboxname].

In the query the report is based on I've got an additional
field referencing the combobox to where if no company is
selected the report will show all companies. This field
is set to "Is Null". This works fine but it doesn't
display the company names in the page header.

How can I change the control source in the page header to
still display the company names in the header when I don't
actually select a company. Or is this the wrong approach
to take?
 
Place a text control in the header with... (use your own names)
=IIF([Forms]![formname]![IsNullField]="IsNull","All
Companies",[Forms]![formname]![combobox])
If you're reporting on All Companies, don't list them in the header... use
the Company Group header to list each as they are reported upon.
hth
Al Camp
 
Sorry, I did have the text box listed in the company group
header and not page header. Sorry about that. I entered
the formula in the text field of the company group header
in the report and it didn't work. Here is what I entered:

=IIf([Forms]![frmrptparam]![casinonamesort]="IsNull","All
Companies",[Forms]![frmrptparam]![casinonamesort])

In your response you said to enter the [IsNullField] in
the first part of the expression. Are you talking about
the field in the query that I set to Is Null? The above
expression lists the actual combobox on the reports form.
But I did try the actual field that the combobox
references and that didn't work.

Here Is how my query is setup.

In the query, the companyname field has a criteria of:

[Forms]![frmrptparam]![casinonamesort] This references the
report form where the combobox is for selecting a company
to print information on.

Next I added another field in the query and in the field
name I entered the same expression: [Forms]![frmrptparam]!
[casinonamesort], then I entered Is Null in the Or section
that is listed below the critera (I entered nothing in the
criteria of this field).

Again, if I enter nothing in the combobox in the report
form, the report will pull up all the companies and their
information but in the company header it won't show the
company name for each company. It will show the company
name if you select a company from the combobox.

I must be doing something wrong. Any ideas?
-----Original Message-----
Place a text control in the header with... (use your own names)
=IIF([Forms]![formname]![IsNullField]="IsNull","All
Companies",[Forms]![formname]![combobox])
If you're reporting on All Companies, don't list them in the header... use
the Company Group header to list each as they are reported upon.
hth
Al Camp

On my reports form I've got a report where you can select
from a combo box which company you want to print
information. Once selected, the page header of the report
has a text field that will display whichever company I
selected: control source is [Forms]![reportformname]!
[comboboxname].

In the query the report is based on I've got an additional
field referencing the combobox to where if no company is
selected the report will show all companies. This field
is set to "Is Null". This works fine but it doesn't
display the company names in the page header.

How can I change the control source in the page header to
still display the company names in the header when I don't
actually select a company. Or is this the wrong approach
to take?


.
 
Back
Top