Hi All, I’m Italian so first of all sorrry for my bad english. 
I need to realize a “ SELECT TOP n “ function (function preferred than Sub, cause I can call it in a normal access query), but I don’t know anything about VB. I tried to search on the net, on this forum, and I found some kind of code but anything that works for me (even as a sub).
I have a table with 2296 records (“table”), stored in field as ID, name, surname, etc. What I need to do is sorting “n” field randomly by this table, where “n” is a value provided by another query (es. “[table2]![limit]).
I found here a sub that takes this “table” and make an output called “randomtable”, ordering the “ID” field randomly.
So, now, I need a function to be applied in a new query (es. “randomtable_q1”) that limits the records to the “TOP n” where n = [table2]![limit]
Can someone help me? It’s a real problem…
(I’ve posted this in “macro” and in “ VB code”, please admin remove the post from the forum less appropriate. I’ve done it cause probably this thing can be done via macros and VB.)

I need to realize a “ SELECT TOP n “ function (function preferred than Sub, cause I can call it in a normal access query), but I don’t know anything about VB. I tried to search on the net, on this forum, and I found some kind of code but anything that works for me (even as a sub).
I have a table with 2296 records (“table”), stored in field as ID, name, surname, etc. What I need to do is sorting “n” field randomly by this table, where “n” is a value provided by another query (es. “[table2]![limit]).
I found here a sub that takes this “table” and make an output called “randomtable”, ordering the “ID” field randomly.
So, now, I need a function to be applied in a new query (es. “randomtable_q1”) that limits the records to the “TOP n” where n = [table2]![limit]
Can someone help me? It’s a real problem…

(I’ve posted this in “macro” and in “ VB code”, please admin remove the post from the forum less appropriate. I’ve done it cause probably this thing can be done via macros and VB.)