Function Dates Times Class

NowUniqueWithSleep

Return the current date and time accurate to 1/18 of the a second, then sleep for 1 (one) second. 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.

Signature (Visual Basic / VBA)

Public Function NowUniqueWithSleep( _
    ByVal vAnything As Variant _
    ) As Date

Code Example

    ? NowUnique(1): ? NowUnique(2): ? NowUnique(3)
    5/3/96 10:45:23 PM
    5/3/96 10:45:24 PM
    5/3/96 10:45:24 PM
    ? NowUniqueWithSleep(1): ? NowUniqueWithSleep(2): ? NowUniqueWithSleep(3)
    5/3/96 10:45:44 PM
    5/3/96 10:45:45 PM
    5/3/96 10:45:46 PM

Parameters

Parameter Description
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 the current time. 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.)

Notes & Version History

Note This function is used to generate database record insert/update date/times that are approximately one second apart. Using this function can be slow if it is used to generate update times for a large number of records.