This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > FrontPage Programming > February 2005 > Randomly ordered recordset





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Randomly ordered recordset
Brandon Taylor

2005-02-22, 11:20 pm

Hello everyone,

I need to select 10 unique records from an Access DB and order them
randomly. I've searched high and low online for an example of how to
randomize a recordset this way, but can't find an example that quite does
what I want. Opening the recordset isn't a problem, it's the randomization.

Can someone please point me in the right direction?

Thanks in advance,
Brandon


Tom Gahagan

2005-02-23, 6:45 pm

Hi Brandon.....

Help us understand why, If you have only 10 records that you have uniquely
selected from a database in your recordset, do you need to have them show up
in a random order?

Is the order they come in from the queary unacceptable?

If guess one way would be to have a random number generator generate a
number, assign it to a variable and see if the number is between 0 and 9 or
1 and 10 depending on how the recordset assigns record numbers and then get
that record and then repeat the process until all 10 records are displayed.
BUT WHY would you go to that trouble, time to complete the randomizing,
etc?????

Anyway..... best of luck with your problem.

Tom Gahagan


"Brandon Taylor" <bt@btaylordesign.com> wrote in message
news:uFX7GcTGFHA.2932@TK2MSFTNGP15.phx.gbl...
> Hello everyone,
>
> I need to select 10 unique records from an Access DB and order them
> randomly. I've searched high and low online for an example of how to
> randomize a recordset this way, but can't find an example that quite does
> what I want. Opening the recordset isn't a problem, it's the
> randomization.
>
> Can someone please point me in the right direction?
>
> Thanks in advance,
> Brandon
>



Jens Peter Karlsen[FP MVP]

2005-02-23, 6:45 pm

A recordset as such can't be random. You can sort it in different ways
but that's it.
To accomplish what you are after, you could place the result in an array
and then use random numbers to decide in what order you want the results
presented. Remember to exclude numbers when you have used them.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

> -----Original Message-----
> From: Brandon Taylor [mailto:bt@btaylordesign.com]
> Posted At: 23. februar 2005 00:34
> Posted To: microsoft.public.frontpage.programming
> Conversation: Randomly ordered recordset
> Subject: Randomly ordered recordset
>
>
> Hello everyone,
>
> I need to select 10 unique records from an Access DB and
> order them randomly. I've searched high and low online for an
> example of how to randomize a recordset this way, but can't
> find an example that quite does what I want. Opening the
> recordset isn't a problem, it's the randomization.
>
> Can someone please point me in the right direction?
>
> Thanks in advance,
> Brandon
>
>


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews