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

Cancel a Detail line on Report

Status
Not open for further replies.

MIKElaw

Programmer
Nov 4, 2000
116
GB
I have several calculated fields on a detail section line and I would like to cancel the line on a set of conditions.

I have VBA code in the Detail_Print event which reads the data and then decides whether or not it is needed.

So far so good. Now the question

How do I cancel the print of that line?


I am quite sure I am missing something simple here


Mike
 
In the Detail_Format event of your report, try putting this:

If YourConditionIsMet Then
Me.Detail.Visible = False
End If



-Gary
 
Thanks Gary
We're in Access 97
so

Tried that and used

if true
me.detail.visible = true
else
me.detail.visible = false
endif

It prints the first line that should not print and then nothing else at all ???????

Also
Where MARK is a textbox in the detail section

if true
me.mark = "true"
else
me.mark = "false"
endif
This gives TRUE where it should be printed and FALSE where it shouldn't

I think I have hammered myself into the ground on this one so ideas??

Many thanks

Mike



 
It seems to me that this should work just fine:

if true
me.detail.visible = true
else
me.detail.visible = false
endif

I use this all the time, and don't know any other way to hide the different bands of reports.


-Gary
 
Mike,

You should probably use the Cancel method in the On Format event of the detail section. Something like:
Code:
If Me.mark = "false" Then
   Cancel = True
End If

Hoc nomen meum verum non est.
 
Problems solved My thanks to you all

Access had wrapped itself around the end stop. A re-install and it all worked


Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top