Home > Archive > MS Access database support > August 2005 > how to print (or not) the contents of a textbox in a report









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to print (or not) the contents of a textbox in a report
lesperancer@natpro.com

2005-08-26, 7:25 am

I've got 2 tables
tblHdr
hdrId
hdrComments

tblDtl
hdrId
dtlId
dtlDate
dtlComments

the report is sorted by dtlDate, and it prints the hdrComments and the
dtlComments if there is data

I only want to print the hdrComments once if there are 2 sequential
rows with the same hdrId

different hdrId -
hdrId 1, dtlID 1, hdrComments, dtlComments
hdrId 2, dtlId 2, hdrComments, dtlComments

same hdrId -
hdrId 1, dtlID 1, hdrComments, dtlComments
hdrId 1, dtlID 2, dtlComments
hdrId 2, dtlId 2, hdrComments, dtlComments

sometimes it doesn't print the hdrId 1 hdrComments -
hdrId 3, dtlID 1, hdrComments, dtlComments
hdrId 1, dtlID 1, hdrComments, dtlComments
hdrId 2, dtlId 2, hdrComments, dtlComments

this is the code that I'm using

Dim lngHdrId As Long
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
hdrComments.Visible = Not (IsNull(hdrComments)
)
If (hdrComments.Visible) Then
If (hdrId = lngHdrId) Then
hdrComments.Visible = False
End If
End If

lngHdrId = HdrId
End Sub

Private Sub Report_Open(Cancel As Integer)
lngHdrId = -1
End Sub

and it usually works, both occasionally, it sets visible = true (based
on debug.print), with comments data, but the comments don't print

I've tried using this with the onFormat event, same problem

is there any way to do this ?

MGFoster

2005-08-26, 8:24 pm

lesperancer@natpro.com wrote:
> I've got 2 tables
> tblHdr
> hdrId
> hdrComments
>
> tblDtl
> hdrId
> dtlId
> dtlDate
> dtlComments
>
> the report is sorted by dtlDate, and it prints the hdrComments and the
> dtlComments if there is data
>
> I only want to print the hdrComments once if there are 2 sequential
> rows with the same hdrId
>
> different hdrId -
> hdrId 1, dtlID 1, hdrComments, dtlComments
> hdrId 2, dtlId 2, hdrComments, dtlComments
>
> same hdrId -
> hdrId 1, dtlID 1, hdrComments, dtlComments
> hdrId 1, dtlID 2, dtlComments
> hdrId 2, dtlId 2, hdrComments, dtlComments
>
> sometimes it doesn't print the hdrId 1 hdrComments -
> hdrId 3, dtlID 1, hdrComments, dtlComments
> hdrId 1, dtlID 1, hdrComments, dtlComments
> hdrId 2, dtlId 2, hdrComments, dtlComments
>
> this is the code that I'm using
>
> Dim lngHdrId As Long
> Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
> On Error Resume Next
> hdrComments.Visible = Not (IsNull(hdrComments)
)
> If (hdrComments.Visible) Then
> If (hdrId = lngHdrId) Then
> hdrComments.Visible = False
> End If
> End If
>
> lngHdrId = HdrId
> End Sub
>
> Private Sub Report_Open(Cancel As Integer)
> lngHdrId = -1
> End Sub
>
> and it usually works, both occasionally, it sets visible = true (based
> on debug.print), with comments data, but the comments don't print
>
> I've tried using this with the onFormat event, same problem
>
> is there any way to do this ?
>


Set the Hide Duplicates property of the hdrComments control to Yes.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com