Kamis, 22 September 2011

[MS_AccessPros] Re: Last Record of a Group in a Report

 

Thank-you Duane,

That solved most of the exceptions I was finding in my reports and for this I am very thankful. I only add this exception in case you still have the energy to guide me to a solution. The exception is when the same CodeName is used more than once in a billing period against a particular client. ie. It is used on two different days say,
for example:

I have the CodeName in the CodeHeader and that is where I have the txtCodeCount.

In the Deatil Section I have Day and all the other details associated with CodeName. Also I have a txtLineCount here that is a running sum over group.

The IIf statement in txtUnImportant, which is in the deatail section, is as follows:
IIf([txtCodeCount]=[txtGrpCount],"Is Last","Not Last")

The output of txtCodeCount is:
txtCodeCount = 1 for CodeName1. If I use CodeName1 on another day it appears under CodeName1 but is not counted twice so it still is txtCodeCount =1 and then that results in txtCodeCount being off by one and thus the IIf statement will give us ("Not Last")

Any suggestions, again thanks for your help in clearing up most of my exceptions.

Tom.

--- In MS_Access_Professionals@yahoogroups.com, Duane Hookom <duanehookom@...> wrote:
>
>
> No code required for this.
>
> Add a text box in the Group Header:
> Name:txtGrpCount
> Control Source: =Count(*)
> Visible: No
>
> Add a text box in the detail section:
> Name: txtRunSum
> Control Source: =1
> Running Sum: Over Group
> Visible: No
>
> Add another text box in the detail section
> Name: txtUnImportant
> Control Source: =IIf([txtRunSum]=[txtGrpCount],"Is Last","Not Last")
> Visible: of course
>
> Duane Hookom
> MS Access MVP
>
>
>
>
> To: MS_Access_Professionals@yahoogroups.com
> From: kaluuma@...
> Date: Thu, 22 Sep 2011 16:45:29 +0000
> Subject: [MS_AccessPros] Last Record of a Group in a Report
>
>
>
>
>
>
> Hi,
>
> I have a report Grouped on CodeName and Sorted on CodeName with 'A on top'.
> Is it possible to find the last record in a group on a report. I am thinking of a Yes/No this is the last record in this group. If so, can one then use an event such as 'on print' to set a variable.
>
> For example:
>
> Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
> If Me.txtNum = Me.txtCount And Me.txtGrCount = 1 Then
> Me.txtbox = ""
> Else
> If (this is the last record in the group) Then .... I do not know what the IF argument would be for Last Record in a Group thus the parenthesis.
> me.txtbox = "Last Record"
> end if
> Me.txtbox= "Not the last record"
> End If
> End Sub
>
> Thanks for any help.
>
> Tom.
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar