Results 1 to 3 of 3
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    Error with INSERT INTO query

    Hi,
    I have the following SQL query:

    INSERT INTO ComplaintsWithSystemDisorder (ComplaintID, MempSpeciesID, BercSpeciesID, Complaint)
    SELECT ComplaintID, SpeciesID, Tab2.SpeciesID, Complaint
    FROM MempBercWithComplaints Tab1
    INNER JOIN BercComplains Tab2 ON Tab2.SpeciesID = Tab1.BercID

    And I'm getting error:

    Access can't represent the JOIN expression Tab2.SpeciesID = Tab1.BercID in Design View.

    As far as I can see the above fields exist.

    Not sure if I need to use LEFT or RIGHT JOIN. I want to include all records from MempBercWithComplaints Tab1 and some records from BercComplaints Tab2



    Thanks for any help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Are you using the query designer? Build SELECT statement with query designer to get the join correct. Why bother with the table aliases?

    Should BercComplains have a 't' in there?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Thanks June, Yep that was it, missing a 't' - strange how you see things that aren't there.

    And thanks for the suggestion to use query designer - always thought this stuff would be to complicated for a dummy designer, so was trying to help out by writing the SQL - who's the dummy!?

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

Similar Threads

  1. Replies: 9
    Last Post: 02-02-2016, 06:27 AM
  2. Replies: 14
    Last Post: 07-07-2015, 07:39 PM
  3. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  4. Error in "Insert Into" Query
    By WickidWe in forum Queries
    Replies: 16
    Last Post: 12-23-2013, 02:55 PM
  5. Replies: 3
    Last Post: 03-05-2013, 11:17 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