0

Keep on getting error

you tried to execute a query that does not include the specified expression

My SQL looks as follows:

UPDATE TblField LEFT JOIN TblTempStats ON TblField.DomainCatID = TblTempStats.DomainCatID 
SET TblTempStats.EmptyFields = Sum(IIf([fieldname] Is Null,1,0));

Any ideas as to why?

1
  • 1
    Missing a From TblField? Commented Oct 13, 2017 at 7:31

1 Answer 1

1

You should use a domain aggregate for this in my opinion, it avoids the error:

UPDATE TblTempStats 
SET TblTempStats.EmptyFields = 
    DSum(
       "IIf([fieldname] Is Null,1,0)", 
       "TblField",
       IIf(
          TblTempStats.DomainCatID Is Null,
          "TblField.DomainCatID Is Null",
          "TblField.DomainCatID = " & TblTempStats.DomainCatID
       )
    )
Sign up to request clarification or add additional context in comments.

2 Comments

Hi, get error that I need to use an updateable Query - any other ideas? Thank you
Works for all values - except if DomainCatID is null, which I can live with, but do you think there is a way to include null domain cat iD - it is present in the tbltempstats (domaincatid null is a value)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.