Phucon-
It should work with the code I gave you, assuming intG50 is declared at the
module level.
Option Compare Database
Dim intG50 As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' If we haven't already turned on the line label,
If Not intG50 Then
' .. and the number is greater than 50
If Me.intNum > 50 Then
' Show the line and the label
Me.lbl50.Visible = True
Me.line50.Visible = True
' Set the flag to show we have done the display
intG50 = True
End If
Else
' Already displayed flag is set,
' so make sure line and label are hidden
Me.lbl50.Visible = False
Me.line50.Visible = False
End If
End Sub
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
--------------------------
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of saigonf7q5
Sent: Sunday, May 27, 2012 4:45 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Insert a label within report detail lines
Thank you very much for your help Mr.Viescas.
The `lbl50' and the `line50' won't display until I added the line "intG50 =
False" after the Else statement. However, they display on every 2 detail lines
as shown below. Another question that I have is, how do I control to display
"Number greater than 50" only 1 time, instead of display for every record.
Thanks again. Phucon.
Number greater than 50
51
51
Number greater than 50
51
52
Number greater than 50
53
54
Number greater than 50
55
56
Number greater than 50
57
58
Number greater than 50
59
60
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not intG50 Then
If Me.intNum > 50 Then
Me.lbl50.Visible = True
Me.line50.Visible = True
intG50 = True
End If
Else
Me.lbl50.Visible = False
Me.line50.Visible = False
'intG50 = False
End If
End Sub
--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...> wrote:
>
> Phucon-
>
> You could design your Detail section with a line across the top and a label
that
> both have the Visible property set to No. In the Format event of the Detail
> section, put this:
>
> Option Compare Database
> Option Explicit
> Dim intG50 As Integer ' Module level variable
>
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> ' If line not displayed before
> If Not intG50 Then
> ' See if we have exceeded the value
> If Me.Amount > 50 Then
> ' Show the line and label
> Me.lbl50.Visible = True
> Me.lin50.Visible = True
> ' Set variable to show we've done it
> intG50 = True
> End If
> Else
> ' Make sure line and label are not visible
> Me.lbl50.Visible = False
> Me.lin50.Visible = False
> End If
> End Sub
>
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of cc
> Sent: Monday, May 21, 2012 11:09 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Re: Insert a label within report detail lines
>
>
>
> Hello Duane
>
> It is simply a numeric value, the value (500) could happen twice if 2
customers
> have the same amount.
>
> The report that I have been trying to achieve is, seperate the detail lines
into
> 2 sections, it first prints the detail lines that have value <= 500,(1 to 499
> for example) and when it's over 500 then prints the label and then print the
> detail lines which > 501 to 1000...
>
> Thanks
>
> --- In MS_Access_Professionals@yahoogroups.com, "Duane" <duanehookom@> wrote:
> >
> > Are the Amount values in a increasing order so 500 will be hit only once? Is
> this a running sum or just a simple numeric value?
> >
> > Duane Hookom
> > MS Access MVP
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "cc" <saigonf7q5@> wrote:
> > >
> > > Good morning all
> > >
> > > I have a report's record source is based on a query that has a column
named
> "Amount". I am wondering if it's possible to program the report to insert a
> label or column headings after the detail lines meet a specific criterion. For
> example, the value of the "Amount" field has a range from 1 to 1000, when the
> Amount reaches 501, then insert a label "Amount greater than 500". Can this be
> done within report?
> > >
> > > Phucon
> > >
> >
>
Minggu, 27 Mei 2012
RE: [MS_AccessPros] Re: Insert a label within report detail lines
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar