[AccessD] A2003: Random order

Shamil Salakhetdinov shamil at users.mns.ru
Wed Oct 26 14:39:15 CDT 2005


Steve,

RAND(), Checksum() and NewID() are MS SQL functions.
As far as I understood your database in an MS SQL one - then you can use
these functions of just newID() in your source query(MS SQL view or stored
procedure) to get random sequence of source records.

For pure mdb+VBA solution VBA's Rnd() function should be enough.

More complicated mdb+VBA solution based on code from this sample:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q176790

to write something like NewId() and then use XOR VBA operation to implement
something like CheckSum(...)  etc. - is an overkill. I should have not
mentioned it.

Shamil

----- Original Message ----- 
From: "Steve Erbach" <erbachs at gmail.com>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Wednesday, October 26, 2005 10:54 PM
Subject: Re: [AccessD] A2003: Random order


> Shamil,
>
> Whoa! Now THAT'S what I was looking for! Except I can't find anything in
> Access VB help on Checksum() nor NewID(). Am I missing something? I found
> ONE reference to NEWID() in the Access help and ONE for Checksum().
>
> Steve Erbach
>
> On 10/26/05, Shamil Salakhetdinov <shamil at users.mns.ru> wrote:
> >
> > <<<
> > how I might speed this up?
> > >>>
> > Steve,
> >
> > In MS SQL you can use lightning fast query (Northwind db as example):
> >
> > select CategoryId, CategoryName
> > from Categories
> > order by RAND(Checksum(newid()))
> >
> -- 
> 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