Skip to main content
Inspiring
February 7, 2009
Answered

Random record selection in Access

  • February 7, 2009
  • 2 replies
  • 460 views
I need to define a record set in ASP / Access consisting of a single record from the available records.
In PHP / MySQL I have used the following and it works fine:

SELECT *
FROM photolist
ORDER BY RAND()
LIMIT 1

Can anyone give me a suitable recordset definition to do this in access?
This topic has been closed for replies.
Correct answer Newsgroup_User

"whatalotofrubbish" <webforumsuser@macromedia.com> wrote in message
news:gmk6pe$90k$1@forums.macromedia.com...
>I need to define a record set in ASP / Access consisting of a single record
> from the available records.
> In PHP / MySQL I have used the following and it works fine:
>
> SELECT *
> FROM photolist
> ORDER BY RAND()
> LIMIT 1
>
> Can anyone give me a suitable recordset definition to do this in access?
>

Access won't do a "random" command when queried from a web page, although it
can if done so within the actual Access application. ASP pages can certainly
utilize mySQL databases; why not use mySQL as it would be far more robust
and stable than Access would be. If you can't move to mySQL, try this
extension from DMXzone:
http://www.dmxzone.com/go?3705


2 replies

Inspiring
February 9, 2009
Thanks for the info. I am aware of Accesses limitations, but the site I am working on is currently stuck with it.
I have downloaded the extension and will test it later tonight.

I have done this and it works a treat. Best of all its a free download.

Many thanks

Howard Walker
Newsgroup_UserCorrect answer
Inspiring
February 9, 2009

"whatalotofrubbish" <webforumsuser@macromedia.com> wrote in message
news:gmk6pe$90k$1@forums.macromedia.com...
>I need to define a record set in ASP / Access consisting of a single record
> from the available records.
> In PHP / MySQL I have used the following and it works fine:
>
> SELECT *
> FROM photolist
> ORDER BY RAND()
> LIMIT 1
>
> Can anyone give me a suitable recordset definition to do this in access?
>

Access won't do a "random" command when queried from a web page, although it
can if done so within the actual Access application. ASP pages can certainly
utilize mySQL databases; why not use mySQL as it would be far more robust
and stable than Access would be. If you can't move to mySQL, try this
extension from DMXzone:
http://www.dmxzone.com/go?3705