A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Top Records



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2004, 10:17 PM
Gabby
external usenet poster
 
Posts: n/a
Default Top Records

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
  #2  
Old May 31st, 2004, 11:23 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Top Records

On Mon, 31 May 2004 14:17:50 -0700, "Gabby"
wrote:

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!

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.