Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Numbered Query Results


Message #1 by "Mark Weisberger" <markw707@y...> on Fri, 15 Feb 2002 17:40:10
I want each record of my query result numbered 1,2,3, etc. Is this 

possible? If so, how?



Thanks for your help.



Mark Weisberger

markw707@y...
Message #2 by "Leo Scott" <leoscott@c...> on Fri, 15 Feb 2002 09:50:39 -0800
If you write VBA code you could write a public function like this:



Public Function AutoNumber() as Long

   Static lngNumber as Long

   'Since VB automatically sets it to 0 when you dim it

   ' this will start numbering at 1

   lngNumber=lngNumber+1

   AutoNumber=lngNumber

End Function



Then in your query have a field that is:

LineNumber:AutoNumber()



|-----Original Message-----

|From: Mark Weisberger [mailto:markw707@y...]

|Sent: Friday, February 15, 2002 5:40 PM

|To: Access

|Subject: [access] Numbered Query Results

|

|

|I want each record of my query result numbered 1,2,3, etc. Is this 

|possible? If so, how?

|

|Thanks for your help.

|

|Mark Weisberger

|markw707@y...




|

Message #3 by "Mark Weisberger" <markw707@y...> on Fri, 15 Feb 2002 21:40:16
Thanks for the help, but I couldn't make it work. It wouldn't increment 

for each record. It shows as all 1's for all records, then when I run the 

query again it shows as all 2's for all records. ??? MW



> If you write VBA code you could write a public function like this:

> 

> Public Function AutoNumber() as Long

>    Static lngNumber as Long

>    'Since VB automatically sets it to 0 when you dim it

>    ' this will start numbering at 1

>    lngNumber=lngNumber+1

>    AutoNumber=lngNumber

> End Function

> 

> Then in your query have a field that is:

> LineNumber:AutoNumber()

> 

> |-----Original Message-----

> |From: Mark Weisberger [mailto:markw707@y...]

> |Sent: Friday, February 15, 2002 5:40 PM

> |To: Access

> |Subject: [access] Numbered Query Results

> |

> |

> |I want each record of my query result numbered 1,2,3, etc. Is this 

> |possible? If so, how?

> |

> |Thanks for your help.

> |

> |Mark Weisberger

> |markw707@y...




> |

Message #4 by "Leo Scott" <leoscott@c...> on Fri, 15 Feb 2002 15:05:09 -0800
You are correct.  That's what I get for not testing my code before I post

it.



Try this instead. Now unless your user can rerun the query faster than 1

second (DateDiff("s", Start, Now) > 1), the 1, it will start numbering at 1

each time.  Now you must use it like this so it gets called with every row

instead of just once at the start.



LineNumber: AutoNumber([Any one of the other fields in your query]).



I could easily add another parameter that would allow you to set the

starting number.



Public Function AutoNumber(ByVal AnyThing As Variant) As Long

   Static lngNumber As Long

   Static Start As Date

   If DateDiff("s", Start, Now) > 1 Then

      Start = Now

      lngNumber = 0

   End If

   'Since VB automatically sets it to 0 when you dim it

   ' this will start numbering at 1

   lngNumber = lngNumber + 1

   AutoNumber = lngNumber

End Function



|-----Original Message-----

|From: Mark Weisberger [mailto:markw707@y...]

|Sent: Friday, February 15, 2002 9:40 PM

|To: Access

|Subject: [access] RE: Numbered Query Results

|

|

|Thanks for the help, but I couldn't make it work. It wouldn't increment

|for each record. It shows as all 1's for all records, then when I run the

|query again it shows as all 2's for all records. ??? MW

|

|> If you write VBA code you could write a public function like this:

|>

|> Public Function AutoNumber() as Long

|>    Static lngNumber as Long

|>    'Since VB automatically sets it to 0 when you dim it

|>    ' this will start numbering at 1

|>    lngNumber=lngNumber+1

|>    AutoNumber=lngNumber

|> End Function

|>

|> Then in your query have a field that is:

|> LineNumber:AutoNumber()

|>

|> |-----Original Message-----

|> |From: Mark Weisberger [mailto:markw707@y...]

|> |Sent: Friday, February 15, 2002 5:40 PM

|> |To: Access

|> |Subject: [access] Numbered Query Results

|> |

|> |

|> |I want each record of my query result numbered 1,2,3, etc. Is this

|> |possible? If so, how?

|> |

|> |Thanks for your help.

|> |

|> |Mark Weisberger

|> |markw707@y...




|> |

|






Message #5 by "Leo Scott" <leoscott@c...> on Fri, 15 Feb 2002 15:19:00 -0800
After testing it on larger recordsets I don't believe I can get it to work.

I can make it work correctly with maketable queries, but because of the way

Access populates queries in the query grid I am getting unreliable results.

I did make one change below.



|-----Original Message-----

|From: Leo Scott [mailto:leoscott@c...]

|Sent: Friday, February 15, 2002 3:05 PM

|To: Access

|Subject: [access] RE: Numbered Query Results

|

|

|You are correct.  That's what I get for not testing my code before I post

|it.

|

|Try this instead. Now unless your user can rerun the query faster than 1

|second (DateDiff("s", Start, Now) > 1), the 1, it will start numbering at 1

|each time.  Now you must use it like this so it gets called with every row

|instead of just once at the start.

|

|LineNumber: AutoNumber([Any one of the other fields in your query]).

|

|I could easily add another parameter that would allow you to set the

|starting number.

|

|Public Function AutoNumber(ByVal AnyThing As Variant) As Long

|   Static lngNumber As Long

|   Static Start As Date

|   If DateDiff("s", Start, Now) > 1 Then

|      Start = Now

|      lngNumber = 0

|   else

|      Start = Now

|   End If

|   'Since VB automatically sets it to 0 when you dim it

|   ' this will start numbering at 1

|   lngNumber = lngNumber + 1

|   AutoNumber = lngNumber

|End Function

|

||-----Original Message-----

||From: Mark Weisberger [mailto:markw707@y...]

||Sent: Friday, February 15, 2002 9:40 PM

||To: Access

||Subject: [access] RE: Numbered Query Results

||

||

||Thanks for the help, but I couldn't make it work. It wouldn't increment

||for each record. It shows as all 1's for all records, then when I run the

||query again it shows as all 2's for all records. ??? MW

||

||> If you write VBA code you could write a public function like this:

||>

||> Public Function AutoNumber() as Long

||>    Static lngNumber as Long

||>    'Since VB automatically sets it to 0 when you dim it

||>    ' this will start numbering at 1

||>    lngNumber=lngNumber+1

||>    AutoNumber=lngNumber

||> End Function

||>

||> Then in your query have a field that is:

||> LineNumber:AutoNumber()

||>

||> |-----Original Message-----

||> |From: Mark Weisberger [mailto:markw707@y...]

||> |Sent: Friday, February 15, 2002 5:40 PM

||> |To: Access

||> |Subject: [access] Numbered Query Results

||> |

||> |

||> |I want each record of my query result numbered 1,2,3, etc. Is this

||> |possible? If so, how?

||> |

||> |Thanks for your help.

||> |

||> |Mark Weisberger

||> |markw707@y...




||> |

||




|

|




|



Message #6 by "Randy Cornish" <rlcornish@c...> on Sat, 16 Feb 2002 00:31:39
This will work.  It makes the assumption that you have a unique Primary 

Key and that you can pass that into the function as string value.  If you 

have a Primary Key that is a Long, just change the code below to suit 

your needs.  Still uses VBA function recommended by first reply poster.



[declarations]

Private mlngCounter As Long

Private mstrLastRecord As String



Public Function RecordCount(PK As String) As Long

    If PK <> mstrLastRecord Then

        mlngCounter = mlngCounter + 1

        mstrLastRecord = PK

    End If

    RecordCount = mlngCounter

End Function





R



> After testing it on larger recordsets I don't believe I can get it to 

work.

> I can make it work correctly with maketable queries, but because of the 

way

> Access populates queries in the query grid I am getting unreliable 

results.

Message #7 by "David Chapman" <luckychap@b...> on Mon, 18 Feb 2002 20:15:57 +1030
The way to make the function execute for every record instead of once at the

start of processing, is to pass it a field or from the record - you don't

have to use the field in the function, it just fools the system into

executing the function for every record. Thats my experience - I look

forward to finding out what others have made work.



David



-----Original Message-----

From: Leo Scott [mailto:leoscott@c...]

Sent: Saturday, February 16, 2002 9:35 AM

To: Access

Subject: [access] RE: Numbered Query Results





You are correct.  That's what I get for not testing my code before I post

it.



Try this instead. Now unless your user can rerun the query faster than 1

second (DateDiff("s", Start, Now) > 1), the 1, it will start numbering at 1

each time.  Now you must use it like this so it gets called with every row

instead of just once at the start.



LineNumber: AutoNumber([Any one of the other fields in your query]).



I could easily add another parameter that would allow you to set the

starting number.



Public Function AutoNumber(ByVal AnyThing As Variant) As Long

   Static lngNumber As Long

   Static Start As Date

   If DateDiff("s", Start, Now) > 1 Then

      Start = Now

      lngNumber = 0

   End If

   'Since VB automatically sets it to 0 when you dim it

   ' this will start numbering at 1

   lngNumber = lngNumber + 1

   AutoNumber = lngNumber

End Function



|-----Original Message-----

|From: Mark Weisberger [mailto:markw707@y...]

|Sent: Friday, February 15, 2002 9:40 PM

|To: Access

|Subject: [access] RE: Numbered Query Results

|

|

|Thanks for the help, but I couldn't make it work. It wouldn't increment

|for each record. It shows as all 1's for all records, then when I run the

|query again it shows as all 2's for all records. ??? MW

|

|> If you write VBA code you could write a public function like this:

|>

|> Public Function AutoNumber() as Long

|>    Static lngNumber as Long

|>    'Since VB automatically sets it to 0 when you dim it

|>    ' this will start numbering at 1

|>    lngNumber=lngNumber+1

|>    AutoNumber=lngNumber

|> End Function

|>

|> Then in your query have a field that is:

|> LineNumber:AutoNumber()

|>

|> |-----Original Message-----

|> |From: Mark Weisberger [mailto:markw707@y...]

|> |Sent: Friday, February 15, 2002 5:40 PM

|> |To: Access

|> |Subject: [access] Numbered Query Results

|> |

|> |

|> |I want each record of my query result numbered 1,2,3, etc. Is this

|> |possible? If so, how?

|> |

|> |Thanks for your help.

|> |

|> |Mark Weisberger

|> |markw707@y...




|> |

|













Message #8 by "Mark Weisberger" <markw707@y...> on Wed, 20 Feb 2002 00:20:39
Thanks Leo and Randy for your time on this one.



Both methods worked successfully when the query was a Make Table query.



Both queries had unstable results in select queries. When I scrolled up 

and down in the query result, the line numbers changed.



My goal was a report with numbered results. It seems like Access would 

already have this capability. ??? (Please shoot me now if this is easy and 

my question was worded in a way that didn't indicate this is what I 

wanted).



I made a report based on the query. In Leo's method, the line numbering in 

the report would start over on a new page in a varying way. Sometimes page 

2 would get its numbering restarted, sometimes page 3 would get its 

numbering restarted.



Randy's method would work in a report the first time, but the numbering 

would start at the last number of the previous report the second time.



Here's a combo of the two modules that seems to work pretty well as long 

as the report is not run twice in a row without a rest in between:



Option Compare Database

Option Explicit



Private mlngCounter As Long

Private mstrLastRecord As String



Public Function RecordCount(PK As String) As Long



    Static Start As Date

    If DateDiff("s", Start, Now) > 10 Then

      Start = Now

      mlngCounter = 0

    End If

    

    If PK <> mstrLastRecord Then

        mlngCounter = mlngCounter + 1

        mstrLastRecord = PK

    End If

    RecordCount = mlngCounter

End Function



The field in the query is: LineNumber: RecordCount([PRSSNO])



My question: Could we eliminate the need for the DateDiff checker by 

having an event in the report that sets the counter to zero when the 

report either starts or finishes?



I greatly appreciate the time you guys have put into this! :)



> I want each record of my query result numbered 1,2,3, etc. Is this 

> possible? If so, how?

> 

> Thanks for your help.

> 

> Mark Weisberger

> markw707@y...
Message #9 by "John Ruff" <papparuff@c...> on Tue, 19 Feb 2002 17:12:26 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_0012_01C1B968.9AED8800

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: 7bit



Mark,



If this is for a report, don't try to do this in the query.  It can be

done in the report itself.  Go to Microsoft's knowledgebase and look up

Article # Q98798.  The URL is below.



http://support.microsoft.com/default.aspx?scid=kb;en-us;Q98790



It's title is "How to Print Line Number for Each Record/Group on Report"

and it works with all versions of MS Access.







John Ruff - The Eternal Optimist :-)



Always looking for Contract Opportunities



 



9306 Farwest Dr SW



Lakewood, WA 98498



papparuff@c...











-----Original Message-----

From: Mark Weisberger [mailto:markw707@y...]

Sent: Wednesday, February 20, 2002 12:21 AM

To: Access

Subject: [access] Re: Numbered Query Results





Thanks Leo and Randy for your time on this one.



Both methods worked successfully when the query was a Make Table query.



Both queries had unstable results in select queries. When I scrolled up

and down in the query result, the line numbers changed.



My goal was a report with numbered results. It seems like Access would

already have this capability. ??? (Please shoot me now if this is easy

and

my question was worded in a way that didn't indicate this is what I

wanted).



I made a report based on the query. In Leo's method, the line numbering

in

the report would start over on a new page in a varying way. Sometimes

page

2 would get its numbering restarted, sometimes page 3 would get its

numbering restarted.



Randy's method would work in a report the first time, but the numbering

would start at the last number of the previous report the second time.



Here's a combo of the two modules that seems to work pretty well as long

as the report is not run twice in a row without a rest in between:



Option Compare Database

Option Explicit



Private mlngCounter As Long

Private mstrLastRecord As String



Public Function RecordCount(PK As String) As Long



    Static Start As Date

    If DateDiff("s", Start, Now) > 10 Then

      Start = Now

      mlngCounter = 0

    End If

   

    If PK <> mstrLastRecord Then

        mlngCounter = mlngCounter + 1

        mstrLastRecord = PK

    End If

    RecordCount = mlngCounter

End Function



The field in the query is: LineNumber: RecordCount([PRSSNO])



My question: Could we eliminate the need for the DateDiff checker by

having an event in the report that sets the counter to zero when the

report either starts or finishes?



I greatly appreciate the time you guys have put into this! :)



> I want each record of my query result numbered 1,2,3, etc. Is this

> possible? If so, how?

>

> Thanks for your help.

>

> Mark Weisberger

> markw707@y...













Message #10 by "Mark Weisberger" <markw707@y...> on Wed, 20 Feb 2002 18:43:38
Thanks John, that works fine.



Sorry everybody for not wording the question correctly the first time. :(



Mark



> This is a multi-part message in MIME format.

> 

> ------=_NextPart_000_0012_01C1B968.9AED8800

> Content-Type: text/plain;

> 	charset="us-ascii"

> Content-Transfer-Encoding: 7bit

> 

> Mark,

> 

> If this is for a report, don't try to do this in the query.  It can be

> done in the report itself.  Go to Microsoft's knowledgebase and look up

> Article # Q98798.  The URL is below.

> 

> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q98790

> 

> It's title is "How to Print Line Number for Each Record/Group on Report"

> and it works with all versions of MS Access.

> 

> 

> 

> John Ruff - The Eternal Optimist :-)

> 

> Always looking for Contract Opportunities

> 

>  

> 

> 9306 Farwest Dr SW

> 

> Lakewood, WA 98498

> 

> papparuff@c...

> 

> 

> 

> 

> 

> -----Original Message-----

> From: Mark Weisberger [mailto:markw707@y...]

> Sent: Wednesday, February 20, 2002 12:21 AM

> To: Access

> Subject: [access] Re: Numbered Query Results

> 

> 

> Thanks Leo and Randy for your time on this one.

> 

> Both methods worked successfully when the query was a Make Table query.

> 

> Both queries had unstable results in select queries. When I scrolled up

> and down in the query result, the line numbers changed.

> 

> My goal was a report with numbered results. It seems like Access would

> already have this capability. ??? (Please shoot me now if this is easy

> and

> my question was worded in a way that didn't indicate this is what I

> wanted).

> 

> I made a report based on the query. In Leo's method, the line numbering

> in

> the report would start over on a new page in a varying way. Sometimes

> page

> 2 would get its numbering restarted, sometimes page 3 would get its

> numbering restarted.

> 

> Randy's method would work in a report the first time, but the numbering

> would start at the last number of the previous report the second time.

> 

> Here's a combo of the two modules that seems to work pretty well as long

> as the report is not run twice in a row without a rest in between:

> 

> Option Compare Database

> Option Explicit

> 

> Private mlngCounter As Long

> Private mstrLastRecord As String

> 

> Public Function RecordCount(PK As String) As Long

> 

>     Static Start As Date

>     If DateDiff("s", Start, Now) > 10 Then

>       Start = Now

>       mlngCounter = 0

>     End If

>    

>     If PK <> mstrLastRecord Then

>         mlngCounter = mlngCounter + 1

>         mstrLastRecord = PK

>     End If

>     RecordCount = mlngCounter

> End Function

> 

> The field in the query is: LineNumber: RecordCount([PRSSNO])

> 

> My question: Could we eliminate the need for the DateDiff checker by

> having an event in the report that sets the counter to zero when the

> report either starts or finishes?

> 

> I greatly appreciate the time you guys have put into this! :)

> 

> > I want each record of my query result numbered 1,2,3, etc. Is this

> > possible? If so, how?

> >

> > Thanks for your help.

> >

> > Mark Weisberger

> > markw707@y...




> 

> 

> 

> ------=_NextPart_000_0012_01C1B968.9AED8800

> Content-Type: text/html;

> 	charset="us-ascii"

> Content-Transfer-Encoding: quoted-printable

> 

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> <HTML><HEAD>

> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; 

> charset=3Dus-ascii">

> <TITLE>Message</TITLE>

> 

> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR></HEAD>

> <BODY><!-- Converted from text/plain format -->

> <P><FONT size=3D2>Mark,<BR><BR>If this is for a report, don't try to do 

> this in

> the query.&nbsp; It can be done in the report itself.&nbsp; Go to 

> Microsoft's

> knowledgebase and look up Article # Q98798.&nbsp; The URL is 

> below.<BR><BR><A

> href=3D"http://support.microsoft.com/default.aspx?scid=3Dkb;en-

us;Q98790"

> >http://support.microsoft.com/default.aspx?scid=3Dkb;en-

us;Q98790</A><BR>

> <BR>It's

> title is "How to Print Line Number for Each Record/Group on Report" and 

> it works

> with all versions of MS Access.<BR><BR></P>

> <DIV align=3Dleft>

> <P class=3DMsoNormal style=3D"MARGIN: 5pt 0in; mso-layout-grid-align: 

> none"><B

> style=3D"mso-bidi-font-weight: normal"><I

> style=3D"mso-bidi-font-style: normal"><SPAN

> style=3D"FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 'Lucida 

> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: 

> yes">John

> Ruff </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I

> style=3D"mso-bidi-font-style: normal"><SPAN

> style=3D"FONT-SIZE: 14pt; COLOR: navy; FONT-FAMILY: 'Lucida 

> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: 

> yes">-

> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I

> style=3D"mso-bidi-font-style: normal"><SPAN

> style=3D"FONT-SIZE: 14pt; COLOR: #993366; FONT-FAMILY: 'Lucida 

> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: 

> yes">The

> Eternal Optimist :-)</SPAN></I></B></P>

> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN

> style=3D"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'">Always

> looking for Contract Opportunities<?xml:namespace prefix =3D o ns =3D

> "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>

> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B

> style=3D"mso-bidi-font-weight: normal"><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'"><o:p>&nbsp;</o:p></SPAN></B></P>

> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><?xml:namespace 

> prefix =3D st1 ns =3D

> "urn:schemas-microsoft-com:office:smarttags" 

> /><st1:Street><st1:address><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">9306 Farwest 

> Dr

> SW</SPAN></st1:address></st1:Street><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'"><o:p></o:p></SPAN></P>

> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 

> 0pt"><st1:place><st1:City><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'">Lakewood</SPAN></st1:City><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">,

> </SPAN><st1:State><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'">WA</SPAN></st1:State><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">

> </SPAN><st1:PostalCode><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'">98498</SPAN></st1:PostalCode></st1:place><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'"><o:p></o:p></SPAN></P>

> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN

> style=3D"COLOR: black; FONT-FAMILY: 'Lucida 

> Calligraphy'">papparuff@c...<o:p></o:p></SPAN></P></DIV>

> <P><BR><BR><BR><BR>-----Original Message-----<BR>From: Mark Weisberger 

> [<A

> href=3D"mailto:markw707@y...">mailto:markw707@y...</A>]

<BR>Sent

> :

> Wednesday, February 20, 2002 12:21 AM<BR>To: Access<BR>Subject: [access] 



> Re:

> Numbered Query Results<BR><BR><BR>Thanks Leo and Randy for your time on 

> this

> one.<BR><BR>Both methods worked successfully when the query was a Make 

> Table

> query.<BR><BR>Both queries had unstable results in select queries. When 

> I

> scrolled up<BR>and down in the query result, the line numbers 

> changed.<BR><BR>My

> goal was a report with numbered results. It seems like Access 

> would<BR>already

> have this capability. ??? (Please shoot me now if this is easy and<BR>my 



> 

> question was worded in a way that didn't indicate this is what

> I<BR>wanted).<BR><BR>I made a report based on the query. In Leo's 

> method, the

> line numbering in<BR>the report would start over on a new page in a 

> varying way.

> Sometimes page<BR>2 would get its numbering restarted, sometimes page 3 

> would

> get its<BR>numbering restarted.<BR><BR>Randy's method would work in a 

> report the

> first time, but the numbering<BR>would start at the last number of the 

> previous

> report the second time.<BR><BR>Here's a combo of the two modules that 

> seems to

> work pretty well as long<BR>as the report is not run twice in a row 

> without a

> rest in between:<BR><BR>Option Compare Database<BR>Option

> Explicit<BR><BR>Private mlngCounter As Long<BR>Private mstrLastRecord As 



> 

> String<BR><BR>Public Function RecordCount(PK As String) As

> Long<BR><BR>&nbsp;&nbsp;&nbsp; Static Start As 

> Date<BR>&nbsp;&nbsp;&nbsp; If

> DateDiff("s", Start, Now) &gt; 10 Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 



> Start =3D

> Now<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mlngCounter =3D 

> 0<BR>&nbsp;&nbsp;&nbsp; End

> If<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; If PK &lt;&gt; 

> mstrLastRecord

> Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mlngCounter =3D 

> mlngCounter +

> 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mstrLastRecord =3D

> PK<BR>&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; RecordCount =3D

> mlngCounter<BR>End Function<BR><BR>The field in the query is: 

> LineNumber:

> RecordCount([PRSSNO])<BR><BR>My question: Could we eliminate the need 

> for the

> DateDiff checker by<BR>having an event in the report that sets the 

> counter to

> zero when the<BR>report either starts or finishes?<BR><BR>I greatly 

> appreciate

> the time you guys have put into this! :)<BR><BR>&gt; I want each record 

> of my

> query result numbered 1,2,3, etc. Is this<BR>&gt; possible? If so,

> how?<BR>&gt;<BR>&gt; Thanks for your help.<BR>&gt;<BR>&gt; Mark

> Weisberger<BR>&gt; markw707@y...<BR>---<BR>Change your mail options 



> at <A

> 

href=3D"http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp<

> /A>

> or<BR>

> $subst('Email.Unsub').<BR></FONT></P></BODY></HTML>

> 

> ------=_NextPart_000_0012_01C1B968.9AED8800--

> 


  Return to Index