random select query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make a query that selects random records that match one criteria.
 
Well you could make a function whereby you use your record_id as source value.
Code below is not tested but give you some ideas. also don't forget to play
with the upperbound value.

- Raoul


e.g.

Public Function IncludeRecord(ID as long) as boolean
dim upperbound as integer
dim lowerbound as integer
dim RandomValue as integer

Randomize
upperbound=99
lowerbound=0
RandomValue=Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
IncludeRecord= ((ID mod upperbound+1)=randomvalue)

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top