Generating a Sequence Number

BPlenge

Registered User.
Local time
Yesterday, 19:52
Joined
May 14, 2007
Messages
10
I am using the following code to generate a sequence number. It works, but my issue is that it starts numbering on the second record. IE: record two shows a 1; record three shows a 2, etc. Can some one tell me how to make the first record show a 1, etc?


Dim DtlSRecipIDCurrent, DtlSRecipIDPrevious As Variant
Dim DtlSPayToProvCurrent, DtlSPayToProvPrevious As Variant
Dim RecipSeqNumber As Integer

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

DtlSPayToProvCurrent = Me.txtDtlSPayToProvID
DtlSRecipIDCurrent = Me.txtSRecipOrigID

If DtlSPayToProvCurrent = DtlSPayToProvPrevious Then
If DtlSRecipIDCurrent <> DtlSRecipIDPrevious Then
RecipSeqNumber = RecipSeqNumber + 1
End If
ElseIf DtlSPayToProvCurrent <> DtlSPayToProvPrevious Then
RecipSeqNumber = 1
End If

Me.txtSRecipSeqNum = RecipSeqNumber
'Me.txtSRecipSeqNum = 3

DtlSPayToProvPrevious = DtlSPayToProvCurrent
DtlSRecipIDPrevious = DtlSRecipIDCurrent


Thanks for you help.

Bill
 
Put an entry in the Report Header OnFormat routine to initialize that counter to 1.
 
Doc_Man - Thanks for your reply. I don't want the counter to necessarily reset at every page. Basically, what I'm trying to do is a running sum within a group.

The report has three groups. I tried the regular running sum function on the report, but the report is basing the count on group 2, and I want the count to be based on group 3. Is there a way to control what group the report bases the count on?

Congratulations on being a grand pa.
 
Set an unbound textbox control source to =1 , set the running sum property to over group
 
I have the running sum in group 3. It resets when group 2 changes values. Is there a way to get it to reset when group 1 changes values?

Thanks.
 

Users who are viewing this thread

Back
Top Bottom