Signature (Visual Basic / VBA)
Public Function RandomLongArg( _
ByVal vAnything As Variant _
) As Variant
Code Examples
Rnd(-1) = 0.224007
RandomLongArg(1) = 352781522
RandomLongArg(2) = 1096661399
RandomLongArg(3) = 1439299645
RandomLongArg("Alpha") = 193695195
RandomLongArg("Bravo") = 1951273186
RandomLongWithinRange(MaxInteger + 1, MaxLong - 1)
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 generate a unique random Long 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.) |
Notes & Version History
| Note | The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement. |
| Note | This function is mostly obsolete now that Microsoft Access for Windows 95 has a data type which generates random primary key values. |