<-- Previous || Up || Next -->

Sequence Long Function
Basic Extensions Class

Public Function SequenceLong( _
    ByVal vAnything As Variant _
    ) As Long

Return a sequence number which starts at one the first time this function is called.
Forces the Microsoft Access Query optimizer to execute this function call for each row of the SQL UPDATE statement in which it is normally used; see below.

Examples:
    SequenceLong("Alpha") = 1
    SequenceLong("Bravo") = 2
    SequenceLong("Charlie") = 3
See also:
    SequenceLongBE Function (In file ESTINAC2.TXT, et. al.)
    NowUnique Function
    RandomLongArg Function
vAnything: The value of one or more columns within the Access Query. For each unique value of the expression passed via vAnything, Microsoft Access will call this function once to get a sequence number. If one or more Query rows have the same value for vAnything, Microsoft Access will use the previous result that was calculated by calling the function with the same argument. (There is no way to tell Microsoft Access that a function is "volatile" and to cause it to evaluate the function once for each row within the Query.)
Applications: This function is useful for assigning sequence numbers to the rows of a table in cases where the column is numeric and you do not particularly care about the starting sequence number. In general though, you should use an AutoNumber data type Column to represent record serial numbers within Microsoft Access database tables.
Note: There is no way to reset the counter used by this function, but you can create a new instance of this Class to have the SequenceLong function start counting from 1 (one).

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.