+ Reply to Thread
Results 1 to 4 of 4

Syntaxt Error (missing operator) in query expression!

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    USA
    MS-Off Ver
    2010 Pro
    Posts
    13

    Syntaxt Error (missing operator) in query expression!

    Hello all,

    I'm running into the following error while trying to run a query.. Can anyone shed some light on it? I've read that the error is typically related to needing ()'s somewhere around the join, but I cant make sense of it..

    tblTest:

    strProdCode - Text
    dtmFrom - Date/Time

    tblProduct
    strProdCode - Text
    dtmFrom - Date/Time

    The Error:
    syntax error (missing operator) in query expression 'tblTest.dtmFrom FROM tblTest INNER JOIN tblProduct ON tblTest.strProdCode = tblProduct.strProdCode'

    The Query:
    UPDATE tblProduct
    SET tblProduct.dtmFrom = tblTest.dtmFrom
    FROM tblTest INNER JOIN tblProduct ON tblTest.strProdCode = tblProduct.strProdCode
    WHERE
    tblProduct.dtmFrom IS NULL;

    The Goal:
    Update tblProduct.dtmFrom if it is NULL and set it to tblTest.dtmFrom where the strProdCode is the same in both. I have a bunch of strProdCodes with null values currently, and I am trying to replace them, but only if they are null.

    Thanks,
    DAN

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Syntaxt Error (missing operator) in query expression!

    Try:

    UPDATE tblProduct INNER JOIN tblTest ON tblTest.strProdCode = tblProduct.strProdCode SET tblProduct.dtmFrom = tblTest.dtmFrom
    WHERE (tblProduct.dtmFrom IS NULL);
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    02-14-2013
    Location
    USA
    MS-Off Ver
    2010 Pro
    Posts
    13

    Re: Syntaxt Error (missing operator) in query expression!

    Romperstomper, this code did the trick perfectly! Thank you. Do I always need to do my joins before trying to do anything with fields?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Syntaxt Error (missing operator) in query expression!

    No - that's just the way you have to write an update query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1