Search code examples
sqlms-accessrecord-count

MS Access - What's wrong with this DCount statement?


I'm getting an error with the following line of code:

DCount("Letter Status","Letter Status","[Letter Status] = 'Received letter'")

The error I'm getting in Access 2007 says

Missing Operator but I don't see how or where.

(Letter status is the name of the field and the table (it's a working design, sorry)


Solution

  • You are missing some square brackets:

     DCount("[Letter Status]","[Letter Status]","[Letter Status] = 'Received letter'")
    

    It is best to name fields and tables without using spaces.