What if you declare a function like this:
Public Function GetRandom(ByVal dummy As Long) As Double
Static blnRandomized As Boolean
If blnRandomized <> True Then
blnRandomized = True
Randomize
End If
GetRandom = Rnd()
End Function
Then add a column to your query, eg GetRandom([ProdID]) AS SortOrder
and ORDER BY SortOrder
The dummy arg is there because I have found that if Access sees a function
with no args it assumes that it always returns the same result and so it
just evaluates it once and uses that result for every row it returns.
HTH
"Andrew Banks" <ba****@nojunkblueyonder.co.uk> wrote in message
news:Df*******************@news-text.cableinet.net...
Very good point!
I'm using and Access DB and I'm afraid I have no option to change to SQL
Server
"Harag" <ha***@REMOVETHESECAPITALSsofthome.net> wrote in message
news:kg********************************@4ax.com...
Would help better if you say what DB your using...
if your using SQL Server try
ORDER BY NEWID()
HTH
Al
On Fri, 14 Nov 2003 17:19:30 GMT, "Andrew Banks"
<ba****@nojunkblueyonder.co.uk> wrote:
I'm trying to order a recordset randomly. I've tried the following
ORDER BY Rnd(ProdID) - ProdID is my primary key
I've read that this will be random but will always return the same
randomorder. I've also read that using the following should resolve this
ORDER BY Rnd(Timer()) - this still gives me the same problem
I've only got 16 recors in the DB at the moment if this is relevant.
Can anyone help me return my recordset in a new random order every time
EVERY time
Thanks in advance