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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop a Row in Report Printing 1

Status
Not open for further replies.

Trob70

Programmer
Sep 25, 2012
89
AU
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


Trob70

 
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".
 
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
field1.visible=false
field2.visible=false
endif


if Fieldo <> "O" then

field1.visible=true
field2.visible=true

endif

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

Trob70

 
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
 
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:
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


Duane
Hook'D on Access
MS Access MVP
 
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

 
dhookom

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

Regards Trob70
 
dhookom

Gave it a try and it did work

Much simpler way many thanks


Regards Trob70
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top