Use a combo box to display specific fields in report (1 Viewer)

azhar2006

Registered User.
Local time
Yesterday, 17:04
Joined
Feb 8, 2012
Messages
202
Hello,
Hello guys . I hope to find someone to help me.
I have a report in the database based on a query and through a button on the form the report appears to me with all its fields according to the query. What I want is to hide and show some columns in the report. for example.
I need a report for workers in which the worker's name, identification number, working hours, age.
But the other day I need the same report, but it does not contain, for example, the working hours field
how can I do that .
Thanks to all
 

Ranman256

Well-known member
Local time
Yesterday, 20:04
Joined
Apr 9, 2015
Messages
4,337
In the report ON PRINT event,hide or show fields based on the form switch:

txtBox.visible = forms!fMyForm!cboBox= “Worker”
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:04
Joined
May 7, 2009
Messages
19,245
you can also create a Query with the Columns you like to show in report.
then Create a Report out of this Query.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:04
Joined
Feb 19, 2002
Messages
43,302
If the hide/show is simple and doesn't leave unpleasant gaps, then you can use a single report with code in the format event to hide/show fields. Otherwise, build separate reports.
 

azhar2006

Registered User.
Local time
Yesterday, 17:04
Joined
Feb 8, 2012
Messages
202
Thank you very much, my dear colleagues.
I have added this code in the query. But I face a problem when the fields for some records are empty.
Code:
IIf(IsNull([Forms]![frmcomSearch]![cmboFirstRtba]);[Rtba];[Forms]![frmcomSearch]![cmboFirstRtba])
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:04
Joined
May 7, 2009
Messages
19,245
create another column but Untick the "Show".
put the criteria there:

Expr1: [Rtba] & ""
Show: (Untick)
Criteria: IIf(IsNull([Forms]![frmcomSearch]![cmboFirstRtba]);[Rtba] & "";[Forms]![frmcomSearch]![cmboFirstRtba])
 

Users who are viewing this thread

Top Bottom