Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i remove a page break or field if null

Status
Not open for further replies.

rccs1

Programmer
May 19, 2007
14
0
0
AU
I have a report where the main data is on the first page, however, one field I want to print on the second page if it is not null.I have set up the report with all the fields on the first page except for the particular field - "Additional Info". If "Additional Info" is empty, I don't want to print the second page. I have tried using a page break to force the second page and then coded the following, but this still prints a blank page which I don't want. Do I have a page break and make it visible false or can I conditionally remove the field if null so I only get the first page if the "Additional Info" is null. If it has data, then I want both pages printed.

Here is my code so far -
If ((IsNull(AdditionalInfo))) Then

'Remove following fields from second page if null
LabelDocketNo.Visible = False
txtDktNo.Visible = False
Line1.Visible = False
LabelFunction.Visible = False
txtFunction.Visible = False
LabelDate.Visible = False
txtDate.Visible = False
LabelTime.Visible = False
txtTime.Visible = False
LabelRoom.Visible = False
txtRoom.Visible = False
txtRoomID.Visible = False
LabelOrganisation.Visible = False
txtOrganisation.Visible = False

AdditionalInfo.Visible = False
Me.Label548.Visible = False
pgbreak.Visible = False





Else
LabelDocketNo.Visible = False
txtDktNo.Visible = False
Line1.Visible = False
LabelFunction.Visible = True
txtFunction.Visible = True
LabelDate.Visible = True
txtDate.Visible = True
LabelTime.Visible = True
txtTime.Visible = True
LabelRoom.Visible = True
txtRoom.Visible = True
txtRoomID.Visible = True
LabelOrganisation.Visible = True
txtOrganisation.Visible = True

AdditionalInfo.Visible = True
Me.Label548.Visible = True
pgbreak.Visible = True

End If
 
I would place all the additional fields in a subreport that is set to can grow and can shrink. Use code to hide or show the subreport and set the pagebreak to invisible.

Duane MS Access MVP
Now help me support United Cerebral Palsy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top