Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Stop a Row in Report Printing

Stop a Row in Report Printing

Access Report...

I need to stop and entire row with several fields in it... printing
if... a particular field is = "O"

Ie i need to totally non print the line
if i make fields invisible=false they do not print but
it leaves a blank line

if Field1="O" and line contains a field call Address1 then do not print line at all not even a blank line

Really appreciate some help


RE: Stop a Row in Report Printing

It can be done using the details section onprint event, but in this case why would you just not build the form's recordsource query to exclude records where field1="o".

RE: Stop a Row in Report Printing

Thanks Majp for this idea... but i do need all types "O" and "R" on the report

I found another way of doing it after a lot of attempts which seemed to work

I set each field on the line as "can shrink"

Then in vba code

if field0="O" then

if Fieldo <> "O" then



This does work... ie if if i use can shrink and visible=


RE: Stop a Row in Report Printing

Makes zero sense to me. Why would need all types returned but not show them? The correct way is to not return records you do not plan on showing. There is both queries and report level filters

RE: Stop a Row in Report Printing

I think the issue is the definition of "on the line". Since Trob70 didn't provide any sample data rendering and how it should look we can't be sure what is being asked. If you are referring to the entire detail section the simplest solution is adding code to the On Format event of the detail section. You will need to change the name of the text box control to match your report.

CODE --> vba

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = Me.txtOorR = "O"
End Sub 

There might be situations where the hidden rows/records have numeric fields that need to be totaled in group or report footer sections.

If you only want to hide specific controls and close the space they had taken, just set the controls and the section to Can Shrink: Yes

Hook'D on Access
MS Access MVP

RE: Stop a Row in Report Printing

Sorry ........Maybe i did not explain properly

I am producing an invoice which has 9 lines per item on the invoice


On the designed Report i Need the 10 Lines in the report , so
i can print either of the lines i need for an "R" or "O" product type.

If the item is a "R" Type Lines 1 2 3 4 5 8 only show

If the item is a "O" Type Lines 1 2 6 7 8 9 show

Ie i do not want blank lines between the lines i need to print
i need them right under each other..

The method i worked out works perfectly...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If ONETIME = "O" Then
Label143.Visible = False
WMONTH.Visible = False
Issuex.Visible = False

Label53.Visible = False
FEATURED.Visible = False

Label54.Visible = False
Desc.Visible = False

Label152.Visible = True
Label153.Visible = True
Label154.Visible = True
Label155.Visible = True

Label63.Visible = False

T1.Visible = True
T2.Visible = True
T2.Visible = True
T2.Visible = True

End If

If ONETIME = "R" Then

Label63.Visible = True

Label152.Visible = False
Label153.Visible = False
Label154.Visible = False
Label155.Visible = False

T1.Visible = False
T2.Visible = False
T2.Visible = False
T2.Visible = False

Label143.Visible = True
WMONTH.Visible = True
Issuex.Visible = True

Label53.Visible = True
FEATURED.Visible = True

Label54.Visible = True
Desc.Visible = True

End If

End Sub

Appreciate any comments , in case there is a better way of doing it.

Regards Trob70

RE: Stop a Row in Report Printing

You shouldn't need any code if you use text boxes that can shrink. You may need to convert labels to text boxes.

Hook'D on Access
MS Access MVP

RE: Stop a Row in Report Printing


Thanks i had not thought of that... will give it a try later

Regards Trob70

RE: Stop a Row in Report Printing


Gave it a try and it did work

Much simpler way many thanks

Regards Trob70

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close