[AccessD] Random ina query

Gustav Brock Gustav at cactus.dk
Fri May 15 12:03:16 CDT 2009


Hi Susan

Since you write RAND() you may have SQL Server in mind. That - and all other db server engines - are different in this matter.
I've read your tip twice but I couldn't see any reference to this.

As I once wrote about Rnd(), Access and SQL:

<quote>
> What's wrong with using Rnd(Now)?

Every time you close and relaunch Access and run the query, Rnd() will produce the same sequence.
Randomize must be used, and that cannot be done in SQL as it will run in another session.
Thus, retrieving the pseudo random sequence from an external function that does call Randomize is the only solution.
</quote>

/gustav


>>> ssharkins at gmail.com 15-05-2009 18:23:16 >>>
>
> The years passed by and Susan forgot all about it, so in 2007 she wrote a 
> tip without mentioning this trap:
>
>  http://blogs.techrepublic.com.com/howdoi/?p=149 
>
> She does discuss a UDF but, unfortunately, that is for another purpose.

======I think I did discuss the trap -- unless you're talking about 
something else. Depending on argument,  RAND() generates a different set of 
values -- one behavior is to repeat the same values.

Susan H. 





More information about the AccessD mailing list