Results 1 to 7 of 7
  1. #1
    raylward102 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    4

    update query error help

    I have an update query that keeps erroring out; can anyone spot the syntax error; I can't!

    UPDATE b SET b.[type] = a.[type], b.variety = a.variety FROM [lotsDB] AS a INNER JOIN [processed] AS b ON (b.[lotID] = a.[ID])


    The vague error:
    Syntax error (missing operator) in query expression 'a.variety FROM [lotsDB] AS a INNER JOIN [processed] AS b ON (b.[lotID] = a.[ID])'.



    I can tell you this; everything in the processed table has a parent in the lotsdb table. the join on lotID to ID are same value types.

    I should add, that I'm running this query against a access.mdb databse via adodb in excel. I'm usually pretty good at this stuff and right queries all the time, but this one has stumped me.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Removed answer. In spite of looking closely, I missed something.
    There's something to be said for posting code/sql within code tags. Makes things easier to read, harder to miss and doesn't interject spaces where they don't belong.

    BTW, why alias these tables when they're not the same table and the names are not overly long?
    Maybe try this (aliasing) as a Select query first. I don't see the issue - sorry.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    raylward102 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    4
    that's a pasted query; Not sure I'm seeing a lone parenthesis you speak of; I see 2 surrounding the join values (could be part of the problem; the fact that I'm not seeing what your seeing??)

    Code:
    UPDATE b SET b.[type] = a.[type], b.variety = a.variety FROM [lotsDB] AS a INNER JOIN [processed] AS b ON (b.[lotID] = a.[ID])

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I guess you replied while I was editing. Review revised post.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Did you use Access query builder to get SQL? I did and shows the following.

    JOIN goes before SET, no FROM clause.
    Code:
    UPDATE lotsDB AS a INNER JOIN [processed] AS b ON a.ID = b.[lotID] SET b.[type] = a.[type], b.variety = a.variety
    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.

  6. #6
    raylward102 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    4
    I didn't use any builder but primarily write update queries for SQL; if what your saying is correct, I've probably written this inappropriately for access; I will quickly adjust according to your logic and see if that helps.

  7. #7
    raylward102 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    4
    Thanks Micro and JUNE7!, for spotting my error. Was driving me nuts!

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

Similar Threads

  1. Error 3450 on an UPDATE query
    By GraeagleBill in forum Programming
    Replies: 12
    Last Post: 07-17-2018, 12:31 PM
  2. update query error
    By koncreat in forum Forms
    Replies: 7
    Last Post: 02-22-2017, 01:53 PM
  3. Update query error
    By msaccessdev in forum Access
    Replies: 1
    Last Post: 06-06-2014, 06:08 AM
  4. Update query Error
    By rd.prasanna in forum Queries
    Replies: 1
    Last Post: 10-04-2013, 03:01 AM
  5. Update query error
    By dccjr in forum Queries
    Replies: 6
    Last Post: 05-21-2013, 08:06 PM

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