+ Reply to Thread
Results 1 to 2 of 2

Can an append query use the count function to add only a limited number of records?

  1. #1
    Registered User
    Join Date
    06-07-2021
    Location
    Mountain Lakes, New Jersey
    MS-Off Ver
    2010
    Posts
    3

    Can an append query use the count function to add only a limited number of records?

    I have created a simple Append query in the Access gui which attempts to use the Count() function.
    An error is produced which states "Cannot have aggregate function in WHERE clause"

    For Criteria, I had set the following:

    Please Login or Register  to view this content.
    Given that every occurence of "MyField" is always greater than zero, I was attempting to establish a record count which I had hoped would update as the Append query executed.
    I had reasoned that once a user-specified record count such as "1000000" had been reached, the Append query would stop.
    I am trying to avoid exceeding the maximum size of a Database in Access.

    I now understand that the Count function is an aggregate function which is not permitted inside a WHERE clause.

    Is there a better way to tell the Append query to stop appending records after a user-specified number of records have already been appended?

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Can an append query use the count function to add only a limited number of records?

    a query cannot sum AND append in the same query.
    you must break it in 2, either:
    1. post the sums to a temp table,then append that table to target
    or
    2. use DSum() in the append query to add the sum

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Append and Store data using Power Query function
    By anay_zinje in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-27-2021, 11:51 AM
  2. Append and Store data using Power Query function
    By anay_zinje in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-27-2021, 11:07 AM
  3. Why would quantity of exported records be limited?
    By delaing in forum Excel General
    Replies: 0
    Last Post: 11-04-2015, 01:59 PM
  4. Report limited to 25 records
    By Herbie95 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2015, 08:30 PM
  5. [SOLVED] Dynamic lookup range - append row count number to column letter
    By astolz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2014, 01:50 PM
  6. [SOLVED] Average Function Limited to the Number of Students
    By alyaahmed in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-06-2014, 10:49 AM
  7. Count Number Of lines in text files and append values to beginning of file
    By motoxeryz125 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2011, 11:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1