p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: Ranked list in report.


Message #1 by "Gerald, Rand" <RGerald@u...> on Fri, 14 Jun 2002 17:48:52 -0500
I'm trying to create a rank field in a report, eg:

Rank	Count	Name
1	100	Mr.Smith
2	 80	Mr. Jones
3	 60	Mr. Brown
3	 60	Mr. Green
5	 50	Mr. White


Note that Mr. Brown and Mr. Green should have the same rank since their
counts are tied.

When I try to do this with code the ranking is correct except that it 
starts
with a very large number that seems to be related to the record count.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
'''''''''''''''''''''''''''
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
'''''''''''''''''''''''''''
Option Compare Database
Option Explicit
Dim intHold As Long
Dim intRank As Long
Dim intIncr As Long
Dim intRecord As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If intRecord =3D 0 Then
        intRank =3D 1
    End If
    If intHold <> [ID_Count] Then
        intHold =3D [ID_Count]
        intRank =3D intRank + intIncr
        intIncr =3D 1
    Else
        intIncr =3D intIncr + 1
    End If
    intRecord =3D intRecord + 1
    [fldRank] =3D intRank
End Sub

Private Sub Report_Activate()
    intHold =3D -1
    intRank =3D 1
    intIncr =3D 0
    intRecord =3D 0

End Sub

Does anyone have any hints or clues about this?

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
 
Message #2 by "Amy Wyatt" <amyw@c...> on Mon, 17 Jun 2002 19:10:09
This is probably a dumb question but I am seeing it in much of the code in 
these threads on p2p. What is the notation 3D for?? I have never seen it 
before and have never used it.

As for the problem you have submitted, I am a little confused as to what 
is not working if the ranking is working? 

Amy

> I'm trying to create a rank field in a report, eg:

Rank	Count	Name
1	100	Mr.Smith
2	 80	Mr. Jones
3	 60	Mr. Brown
3	 60	Mr. Green
5	 50	Mr. White


Note that Mr. Brown and Mr. Green should have the same rank since their
counts are tied.

When I try to do this with code the ranking is correct except that it 
starts
with a very large number that seems to be related to the record count.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
'''''''''''''''''''''''''''
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''
'''''''''''''''''''''''''''
Option Compare Database
Option Explicit
Dim intHold As Long
Dim intRank As Long
Dim intIncr As Long
Dim intRecord As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If intRecord =3D 0 Then
        intRank =3D 1
    End If
    If intHold <> [ID_Count] Then
        intHold =3D [ID_Count]
        intRank =3D intRank + intIncr
        intIncr =3D 1
    Else
        intIncr =3D intIncr + 1
    End If
    intRecord =3D intRecord + 1
    [fldRank] =3D intRank
End Sub

Private Sub Report_Activate()
    intHold =3D -1
    intRank =3D 1
    intIncr =3D 0
    intRecord =3D 0

End Sub

Does anyone have any hints or clues about this?

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
 
Message #3 by "Gerald, Rand" <RGerald@u...> on Mon, 17 Jun 2002 13:36:04 -0500
The "3D" appears to be something that was stuffed into the text when I
pasted the code into the p2p web site.  It can be totally ignored.   
Just
skip over the "3D"s as if they were not there.

This seems to be a problem with the p2p web site using cut & paste.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Amy Wyatt [mailto:amyw@c...]
Sent: Monday, June 17, 2002 2:10 PM
To: Access
Subject: [access] Re: Ranked list in report.

This is probably a dumb question but I am seeing it in much of the code 
in
these threads on p2p. What is the notation 3D for?? I have never seen 
it
before and have never used it.

As for the problem you have submitted, I am a little confused as to 
what
is not working if the ranking is working?

Amy

> I'm trying to create a rank field in a report, eg:

Rank    Count   Name
1       100     Mr.Smith
2        80     Mr. Jones
3        60     Mr. Brown
3        60     Mr. Green
5        50     Mr. White


Note that Mr. Brown and Mr. Green should have the same rank since their
counts are tied.

When I try to do this with code the ranking is correct except that it 
=3D
starts
with a very large number that seems to be related to the record count.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
=3D
''''
'''''''''''''''''''''''''''
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
=3D
''''
'''''''''''''''''''''''''''
Option Compare Database
Option Explicit
Dim intHold As Long
Dim intRank As Long
Dim intIncr As Long
Dim intRecord As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If intRecord =3D3D 0 Then
        intRank =3D3D 1
    End If
    If intHold <> [ID_Count] Then
        intHold =3D3D [ID_Count]
        intRank =3D3D intRank + intIncr
        intIncr =3D3D 1
    Else
        intIncr =3D3D intIncr + 1
    End If
    intRecord =3D3D intRecord + 1
    [fldRank] =3D3D intRank
End Sub

Private Sub Report_Activate()
    intHold =3D3D -1
    intRank =3D3D 1
    intIncr =3D3D 0
    intRecord =3D3D 0

End Sub

Does anyone have any hints or clues about this?

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=3DE1'=3DED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
 =3D20
Message #4 by "Gerald, Rand" <RGerald@u...> on Mon, 17 Jun 2002 17:10:13 -0500
As for the ranks.

I'm trying to create a rank field in a report, eg:

Rank    Count   Name
1       100     Mr. Smith
2        80     Mr. Jones
3        60     Mr. Brown
3        60     Mr. Green
5        50     Mr. White

I actually get a rank field in a report, something like this:

Rank    Count   Name
805     100     Mr. Smith
806      80     Mr. Jones
807      60     Mr. Brown
807      60     Mr. Green
809      50     Mr. White

I'm trying to figure out why the ranks are 804 larger than they should 
be.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Gerald, Rand [mailto:RGerald@u...]
Sent: Monday, June 17, 2002 1:36 PM
To: Access
Subject: [access] Re: Ranked list in report.
Importance: High

The "3D" appears to be something that was stuffed into the text when I
pasted the code into the p2p web site.  It can be totally ignored.   
Just
skip over the "3D"s as if they were not there.

This seems to be a problem with the p2p web site using cut & paste.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Amy Wyatt [mailto:amyw@c...]
Sent: Monday, June 17, 2002 2:10 PM
To: Access
Subject: [access] Re: Ranked list in report.

This is probably a dumb question but I am seeing it in much of the code 
in
these threads on p2p. What is the notation 3D for?? I have never seen 
it
before and have never used it.

As for the problem you have submitted, I am a little confused as to 
what
is not working if the ranking is working?

Amy

> I'm trying to create a rank field in a report, eg:

Rank    Count   Name
1       100     Mr.Smith
2        80     Mr. Jones
3        60     Mr. Brown
3        60     Mr. Green
5        50     Mr. White


Note that Mr. Brown and Mr. Green should have the same rank since their
counts are tied.

When I try to do this with code the ranking is correct except that it 
starts
with a very large number that seems to be related to the record count.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Option Compare Database
Option Explicit
Dim intHold As Long
Dim intRank As Long
Dim intIncr As Long
Dim intRecord As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If intRecord =3D 0 Then
        intRank =3D 1
    End If
    If intHold <> [ID_Count] Then
        intHold =3D [ID_Count]
        intRank =3D intRank + intIncr
        intIncr =3D 1
    Else
        intIncr =3D intIncr + 1
    End If
    intRecord =3D intRecord + 1
    [fldRank] =3D intRank
End Sub

Private Sub Report_Activate()
    intHold =3D -1
    intRank =3D 1
    intIncr =3D 0
    intRecord =3D 0

End Sub

Does anyone have any hints or clues about this?

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx



Message #5 by "Amy Wyatt" <amyw@c...> on Tue, 18 Jun 2002 14:22:58
I am assuming that ID_COUNT is the same as Count in your display below. If 
this is true, I do not know what is going wrong. When I used your exact 
code in a test report and mine worked fine. Have you stepped through to 
see where that big number is coming from? 

Sorry, that is the only thing I can come up with. Otherwise, I would try 
recreating the report to see if it is corrupted for some reason.

Amy

P.S. Thanks for the info on the 3D stuff. That clears up a lot for me.


> As for the ranks.

I'm trying to create a rank field in a report, eg:

Rank    Count   Name
1       100     Mr. Smith
2        80     Mr. Jones
3        60     Mr. Brown
3        60     Mr. Green
5        50     Mr. White

I actually get a rank field in a report, something like this:

Rank    Count   Name
805     100     Mr. Smith
806      80     Mr. Jones
807      60     Mr. Brown
807      60     Mr. Green
809      50     Mr. White

I'm trying to figure out why the ranks are 804 larger than they should 
be.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Gerald, Rand [mailto:RGerald@u...]
Sent: Monday, June 17, 2002 1:36 PM
To: Access
Subject: [access] Re: Ranked list in report.
Importance: High

The "3D" appears to be something that was stuffed into the text when I
pasted the code into the p2p web site.  It can be totally ignored.   
Just
skip over the "3D"s as if they were not there.

This seems to be a problem with the p2p web site using cut & paste.

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx

-----Original Message-----
From: Amy Wyatt [mailto:amyw@c...]
Sent: Monday, June 17, 2002 2:10 PM
To: Access
Subject: [access] Re: Ranked list in report.

This is probably a dumb question but I am seeing it in much of the code 
in
these threads on p2p. What is the notation 3D for?? I have never seen 
it
before and have never used it.

As for the problem you have submitted, I am a little confused as to 
what
is not working if the ranking is working?

Amy

> I'm trying to create a rank field in a report, eg:

Rank    Count   Name
1       100     Mr.Smith
2        80     Mr. Jones
3        60     Mr. Brown
3        60     Mr. Green
5        50     Mr. White


Note that Mr. Brown and Mr. Green should have the same rank since their
counts are tied.

When I try to do this with code the ranking is correct except that it 
starts
with a very large number that seems to be related to the record count.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Option Compare Database
Option Explicit
Dim intHold As Long
Dim intRank As Long
Dim intIncr As Long
Dim intRecord As Long

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If intRecord =3D 0 Then
        intRank =3D 1
    End If
    If intHold <> [ID_Count] Then
        intHold =3D [ID_Count]
        intRank =3D intRank + intIncr
        intIncr =3D 1
    Else
        intIncr =3D intIncr + 1
    End If
    intRecord =3D intRecord + 1
    [fldRank] =3D intRank
End Sub

Private Sub Report_Activate()
    intHold =3D -1
    intRank =3D 1
    intIncr =3D 0
    intRecord =3D 0

End Sub

Does anyone have any hints or clues about this?

Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx




  Return to Index