how do I only pull 5 records (random)?

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

I am using Random: Rnd(IsNull(PowerTabDirectory.Item)*0+1)

to pull random records, how do I only pull X number of records?

If I want 5 records - pull 5 random records.
If next time I run the query I want 3 random records - pull 3 random records

and so on?
 
Hi Bigred,

******** in design view of query

use the TopValues property
ie:
TopValues --> 3
TopValues --> 5

in property window for TopValues you can use "%" to get a
percentage of the records instead of a specific number

TopValues --> 10%

******** to modify the SQL Statement,

SELECT TOP # fieldlist FROM ...

where # is 3 or 5 or however many you want

in SQL: if you follow # with " PERCENT", you will get a
percentage of the records instead of a specific number

ie --> SELECT TOP 10 PERCENT fieldlist...


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
thanks much Crystal


strive4peace said:
Hi Bigred,

******** in design view of query

use the TopValues property
ie:
TopValues --> 3
TopValues --> 5

in property window for TopValues you can use "%" to get a percentage of
the records instead of a specific number

TopValues --> 10%

******** to modify the SQL Statement,

SELECT TOP # fieldlist FROM ...

where # is 3 or 5 or however many you want

in SQL: if you follow # with " PERCENT", you will get a percentage of the
records instead of a specific number

ie --> SELECT TOP 10 PERCENT fieldlist...


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
you're welcome, Bigred ;) happy to help

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
Back
Top