Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Posts
    36

    Unanswered: Get Random Record.......

    Hi all,
    I have two fields in database, ID and Name and 25 record in database..
    I wanna get random 10 record from database....
    So how can i achive...?
    I m using MS Access....
    thanx in advance
    Sajjad
    Regards,
    Sajjad
    C U ON NET
    reply me : sajjaddotnet@yahoo.com

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    A "quick and dirty" way is to add a field called "sort", open the table into a recordset, randomize, and set a "random" number into each field. Then, sort the data by the new field.

    Each time you run the routine, the records are "reordered". There's a chance you'll get 2 records witht he same random number, but hey, they're still in a different order than when you started.

    The things you'll have to look up are:
    Randomize
    RND
    Recordset
    Do ... Loop


    Have fun,
    tc

  3. #3
    Join Date
    Feb 2005
    Posts
    36
    thanx for reply,,
    but can i get random record at Database level.. without any additional field in table ???
    Regards,
    Sajjad
    C U ON NET
    reply me : sajjaddotnet@yahoo.com

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •