Top Records

G

Gabby

I am using a database to which 10 telemarketers are
connected. When I run a query with specific criteria I
get a number of records that fit the criteria.
My first counts those records, giving me an "x" number
result.
My second query takes that number and divides it by 10
(telemarketers) and gives me the number of records I
should assign to each telemarketers individual databases.
My third query uses the "Select Top... Records" function
(built into the query). I have to type into the "Select
Top" function the number resulting from my second query
in order to make a table for each telemarketer with that
number of records (stated in the Select Top function).
Is there a code I can use to have the Select Top filled
in automatically from the result of the second query?
I do not want to have to type in the "Select Top" (with
the result from the second query)every time I have change
the criteria from the first query.
Thanks,
Gabby
 
J

John Vinson

My third query uses the "Select Top... Records" function
(built into the query). I have to type into the "Select
Top" function the number resulting from my second query
in order to make a table for each telemarketer with that
number of records (stated in the Select Top function).
Is there a code I can use to have the Select Top filled
in automatically from the result of the second query?

You may need to write VBA code to actually construct the SQL for this
third query on the fly, incorporating the desired record count. You
can't pass a TOP value as a query parameter.

You might be able to use a criterion on a DCount() function, but it
would be complex, clunky and slow!
 

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