Results 1 to 2 of 2
  1. #1
    Lady_Jane is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    Canada
    Posts
    49

    INSERT INTO not working...cannot find input table or query

    Hi everyone,


    The following query is no longer working:

    Code:
    SELECT qry_RegPercent.UID, qry_RegPercent.Region, qry_RegPercent.Percent INTO tbl_DominantRegion_Oct12
    FROM qry_RegPercent, [SELECT max(Percent) as MaxPct, UID FROM qry_RegPercent GROUP BY UID] AS maxresults
    WHERE (((qry_RegPercent.UID)=maxresults.UID) And ((qry_RegPercent.Percent)=maxresults.MaxPct))
    ORDER BY qry_RegPercent.UID;
    It was working before because I have a tbl_DominantRegion_date in my database created from running the query earlier. The query it references (qry_RegPercent) still works. The error I am getting is: The Microsoft Jet database engine cannot find the input table or query 'SELECT max(Percent) as MaxPct, UID FROM qry_RegPercent GROUP BY UID'. Make sure it exists and that its name is spelled correctly.

    Running the query in an older, backed up, version of the database, and pasting the SQL into a new query produce the same error.

    I don't see anything wrong with the SQL (although I definitely had help writing it), do you?

    Thank-you!

  2. #2
    Lady_Jane is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    Canada
    Posts
    49

    Lightbulb

    I've managed to solve it... but I don't understand how.
    Here is the new query that works:
    Code:
    SELECT qry_RegPercent.UID, qry_RegPercent.Region, qry_RegPercent.Percent
    FROM qry_RegPercent, [SELECT max(Percent) as MaxPct, UID
    FROM qry_RegPercent
    GROUP BY UID]. AS maxresults
    WHERE qry_RegPercent.UID=maxresults.UID And qry_RegPercent.percent=maxresults.MaxPct
    ORDER BY qry_RegPercent.UID;
    The key difference is the period after the subquery. I don't know why that is needed, and I could have sworn I ran it with the period to begin with and got the same error. Oh well.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Insert entire row from query into new row in another table
    By chris.williams in forum Programming
    Replies: 3
    Last Post: 10-13-2011, 01:38 PM
  2. why isn't this insert into working?
    By token_remedie in forum Queries
    Replies: 3
    Last Post: 09-21-2011, 09:14 PM
  3. Find duplicates query to populate input form
    By kctalent in forum Queries
    Replies: 6
    Last Post: 08-22-2011, 03:12 PM
  4. Insert query into table FROM two table sources
    By svcghost in forum Queries
    Replies: 2
    Last Post: 11-05-2010, 09:10 AM
  5. Replies: 0
    Last Post: 02-24-2010, 12:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums