how do I only pull 5 records (random)?

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?
 
S

strive4peace

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
 
B

_Bigred

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
 
S

strive4peace

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
 

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

Top