0
votes

I keep getting this error and I can’t figure out why. If anyone could help it would be much appreciated.

Syntax error (missing operator) in query expression ‘(((plot.[annual charge]) Like "*")) UPDATE Plot SET Plot . [annual charge] = IIF([annual charge]<,[annual charge]+[annual charge]*15/100,[annual charge]*10/100);

Code:

SELECT plot.[annual charge]
FROM (
    (
        member INNER JOIN plot ON (member.[member number] = plot.[member table])
            AND (member.[member number] = plot.[member table])
            AND (member.[member number] = plot.[member table])
        ) INNER JOIN produce ON plot.[plot number] = produce.[plot number]
    )
INNER JOIN vegetables ON produce.[vegtable name] = vegetables.[vegetable name]WHERE (((plot.[annual charge]) LIKE "*"))UPDATE Plot
SET Plot.[annual charge] = IIF([annual charge] <, [annual charge] + [annual charge] * 15 / 100, [annual charge] * 10 / 100);
2
I edited your question to make it more readable, but did not add any white spaces to the query. It seems you are missing white spaces before WHERE and UPDATE. Could that be the reason for this error?René Vogt
@SergeyS. Your edit changed the query! It's possbile that you thereby removed the reason for the error. Please never change code when editing questions.René Vogt
Your IIF() function call seems wrong. You have: IIF([annual charge] <, [annual charge]... (ellipsis mine). You need something besides a comma following that first [annual charge]. What do you want to compare it to?STLDev
I think the whole SQL is wrong. Here are 2 separate SQLs - SELECT and UPDATE. UPDATE for two tables has different syntax.Sergey S.

2 Answers

1
votes

Try this:

UPDATE (
        (
            member INNER JOIN plot ON (member.[member number] = plot.[member table])
                AND (member.[member number] = plot.[member table])
                AND (member.[member number] = plot.[member table])
            ) INNER JOIN produce ON plot.[plot number] = produce.[plot number]
        )
INNER JOIN vegetables ON produce.[vegtable name] = vegetables.[vegetable name]
WHERE (((plot.[annual charge]) LIKE "*"))
SET Plot.[annual charge] = IIF([annual charge] < 1000000, [annual charge] + [annual charge] * 15 / 100, [annual charge] * 10 / 100);

Replace 1000000 by desired number

0
votes

you might want to check your parenthesis. there is an opening brace with no closing brace if i am not mistaken. that could be the cause of your error.