How not print a detail line on a report

I am trying to keep a detail line from printing on a sub-report if a date is later than the date entered on another form.

Here is my code but I don't knwo how to keep the detail line from printing.


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    If Me.detaillineDate > Forms!frmDateRangeAllWorkCenterReport.txtEnd Then
        'dont print the detail line code here
    End If
   
End Sub
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
how about

me.linexxx.visible=false
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Enter these three lines:

Me.PrintSection = False
Me.MoveLayout = False
Me.NextRecord = True
JimD.
cquinnCommented:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    If Me.detaillineDate > Forms!frmDateRangeAllWorkCenterReport.txtEnd Then
        'dont print the detail line code here
        Cancel = True
    End If
   
End Sub
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rey Obrero (Capricorn1)Commented:
guessed i misread this q totally ;-(
SteveL13Author Commented:
Ok... I'm using...
Me.PrintSection = False
Me.MoveLayout = False
Me.NextRecord = True
But now I have a gap between subreports.  I've set all to shrink but it doesn't seem to be happening.
How can I fix this?
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<But now I have a gap between subreports. >>
 With the line omitted, is the subreport now empty?  and will the mail reports detail line still be printed?  also will the remaining sub-reports still print?
 I'm trying to understand the setup a little better.
JimD.
SteveL13Author Commented:
With which line omitted?
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
The one in the sub report, which is where I'm assuming your using this code.  
When you notice the gap, is it because all lines have been omitted for that sub report?
JimD.
SteveL13Author Commented:
The lines that are omitted are the ones that I don't want to print so that part is working perfectly.  But I need the "gap" to shrink.
cquinnCommented:
Try moving the code from the Detail_print event to the Detail_Format event - this should stop the line appearing completely
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.detaillineDate > Forms!frmDateRangeAllWorkCenterReport.txtEnd Then
        'dont print the detail line code here
        Cancel = True
    End If
   
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveL13Author Commented:
This worked perfectly.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.