[AccessD] Query Line Numbers

Keith Williamson kwilliam at ashlandnet.com
Tue Mar 29 08:48:25 CST 2005


Thanks, guys.  I'll give these a try!!

:)

Keith E. Williamson
Ashland Equipment, Inc
phone # (410) 273-1856
fax #     (410) 273-1859


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, March 29, 2005 9:38 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Query Line Numbers


Hi Keith

We use this/these functions for a similar task:

Option Compare Database
Option Explicit
Public lngKeyCounter As Long

Public Function NextKey_Get( _
  Optional ByVal varDummy, _
  Optional ByVal intIncrement As Integer = 1, _
  Optional ByVal intInitial As Integer) As Long
  
  ' Increments dynamic public (global) variable lngKeyCounter with
intIncrement.
  ' Returns the new value of global variable lngKeyCounter.
  ' Parameter varDummy is used to force repeated calls of this function when
used in a query.
  
  Dim intSgn As Integer
  
  If Not intIncrement = 0 Then
    intSgn = Sgn(intIncrement)
    If intSgn * lngKeyCounter < intSgn * intInitial Then
      lngKeyCounter = intInitial
    Else
      lngKeyCounter = lngKeyCounter + intIncrement
    End If
  End If
  
  NextKey_Get = lngKeyCounter
  
End Function

Public Function NextKey_Set( _
  Optional ByVal lngSet As Long) As Long

  ' Sets dynamic public (global) variable lngKeyCounter to value of lngSet.
  ' Retrieves current value of lngKeyCounter.

  NextKey_Set = lngKeyCounter
  lngKeyCounter = lngSet
  
End Function

/gustav

>>> kwilliam at ashlandnet.com 03/29 4:11 pm >>>
This may be an extremely simple thing...and I am just being stupid,
but.....is there a way (within a query) to setup an expression that numbers
the lines?  I can do this simply enough in a report.....but can't think of a
way to do this in a query.  The reason is I am doing a routine that
transfers text to a deliminated text file.  This needs to be based on a
table or query.  I am trying to base this on a query, but need a line
number.  I can't figure out how to do this within the query.

Thanks for any help.

Regards,

Keith E. Williamson
Ashland Equipment, Inc
phone # (410) 273-1856
fax #     (410) 273-1859

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list