Results 1 to 2 of 2
  1. #1
    Gerry is offline Rusty Developer
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    Kings Mountain, NC
    Posts
    33

    Unhappy Access 2007 - Problem with Null value elimination criteria

    REPOST: Prior post had a badly-chosen subject line.

    I'm building a simple append query to add missing records to a table. It examines a list of entries, identifies which are not in the destination table, and adds them. Simple thus far.

    The problem comes when I add a criteria to the source side to ensure no blank entries are appended.

    Here's the SQL I'm trying to use:
    INSERT INTO tblAgents ( AgentID, AgentName )
    SELECT qryAgentsImport.RecAgentID, First(qryAgentsImport.RecAgentName) AS FirstOfRecAgentName
    FROM tblAgents RIGHT JOIN qryAgentsImport ON tblAgents.AgentID = qryAgentsImport.RecAgentID
    GROUP BY qryAgentsImport.RecAgentID, tblAgents.AgentID
    HAVING (((qryAgentsImport.RecAgentID) Is Not Null) AND ((tblAgents.AgentID) Is Null));
    Here's the simple one (not eliminating blank entries) that works fine:
    INSERT INTO tblAgents ( AgentID, AgentName )
    SELECT qryAgentsImport.RecAgentID, First(qryAgentsImport.RecAgentName) AS FirstOfRecAgentName
    FROM tblAgents RIGHT JOIN qryAgentsImport ON tblAgents.AgentID = qryAgentsImport.RecAgentID
    GROUP BY qryAgentsImport.RecAgentID, tblAgents.AgentID
    HAVING (((tblAgents.AgentID) Is Null));
    Here's a screen shot of the query design, with the error showing:


    Interestingly, it doesn't seem to matter what criteria or field I add. Anything specifying limiting criteria on the source table seems to give me the same error message (reworded to match each criterion).



    I'm sure this is something minor, but I'm a bit rusty.

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Instead of 'Group By' try putting 'Where' instead

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

Similar Threads

  1. Problem with label in Access 2007
    By Madraykin in forum Forms
    Replies: 4
    Last Post: 02-04-2010, 10:41 AM
  2. Null Date control code problem
    By DanW in forum Forms
    Replies: 2
    Last Post: 11-10-2009, 03:13 PM
  3. Is null problem
    By rockape in forum Programming
    Replies: 5
    Last Post: 09-29-2009, 12:46 PM
  4. Access 2007 Users and Permissions Problem
    By botts121 in forum Security
    Replies: 3
    Last Post: 07-06-2009, 10:23 AM
  5. Problem using the combo box Access 2007
    By PATATE in forum Access
    Replies: 11
    Last Post: 05-23-2009, 06:26 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