centralmike
asked on
access 2007 randomize
I am trying to create a randomize function in access2007. I would like to run a query to return 100 rows from my table. I would like query to the table an get a different result set everytime i run the query. Help is needed. I am including the database i have started.
ASKER
The random number columns changes. But it returns the same 100 rows each time you run the query.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another similar example:
SELECT TOP 10 tblEmp.EmpID, tblEmp.EmpName
FROM tblEmp
ORDER BY Rnd(Int(Now()*[tblEmp].[Em pID])-Now( )*[tblEmp] .[EmpID]);
mx
SELECT TOP 10 tblEmp.EmpID, tblEmp.EmpName
FROM tblEmp
ORDER BY Rnd(Int(Now()*[tblEmp].[Em
mx
@mike
Please post 20 of your ID values. I'm not seeing that behavior with my table/query.
Please post 20 of your ID values. I'm not seeing that behavior with my table/query.
You will if you close Access and open it and run the query again.
/gustav
/gustav
Guaranteed to not be an issue if you include Now() as shown in my examples.
Yes, this is a great tip.
/gustav
/gustav
Example:
Open in new window
Be aware that the VB PRNG functions are flawed. I wrote an analysis in this article:http:A_11114.html