Results 1 to 2 of 2
  1. #1
    thegrimmerdiscovery is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2017
    Posts
    30

    Unmatched Query & Append

    Hiya



    Had some great advice on basic Access on the Excel boards from Joe4 - not least to get Access support here. Which obviously makes a great deal of sense.

    Almost a total newbie to Access. I'm not sure if this is how it works here regarding etiquette so apols if I've transgressed any rules.

    But here is the SQL I've got based on a small database I'm cutting my teeth on.

    INSERT INTO Table2 ( Artist, Album )
    SELECT Artist, Album
    FROM Table1
    WHERE Album Not In (SELECT Album FROM Table2);

    You'll see that this enables me to copy any new artists and albums from table 1 to table 2 as they're added. It's great.

    But when I try and get all logical and transfer this SQL code to the 'real' database I'm trying to start up it doesn't work:

    INSERT INTO tblMilestones ( ProjectName )
    SELECT ProjectName
    FROM tblAudits
    WHERE ProjectName Not In (SELECT ProjectName FROM tblMilestones);

    I'm trying to copy any new project names from tblAudits to tblMilestones. But now I get a validation rule violation error. I've checked tblAudits and tblMilestones in design view for field names data type incompatibility but they all match up.

    Any clues as to where I'm going wrong?? Thanks in advance.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Access has an unmatched query wizard which I would recommend using at least while you are learning
    Create a query with both tables and use an outer join from tblAudits to tblMilestones using the ProjectName field
    Add the field ProjectName from both tables & untick it for tblMistones. Filter that same value as null
    When done you'll have a SELECT unmatched query.
    Now change it to an APPEND query with tblMilestones as your destination table

    The query SQL is

    Code:
    INSERT INTO tblMilestones ( ProjectName )
    SELECT ProjectName
    FROM tblAudits LEFT JOIN tblMilestones ON tblAudits.ProjectName = tblMilestones.ProjectName
    WHERE tblMilestones.ProjectName Is Null;
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. unmatched query wizard
    By Jen0dorf in forum Access
    Replies: 7
    Last Post: 12-05-2015, 11:58 AM
  2. Unmatched Query
    By Dog17 in forum Queries
    Replies: 3
    Last Post: 08-07-2014, 02:36 PM
  3. Help! Unmatched Records Query
    By Hberg in forum Access
    Replies: 1
    Last Post: 03-09-2012, 03:41 PM
  4. Replies: 1
    Last Post: 12-08-2011, 01:52 PM
  5. Unmatched query on 1 table
    By tmcrouse in forum Access
    Replies: 7
    Last Post: 06-01-2011, 08:38 AM

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