I have a query names "Query_Reagents_by_Mastername". I want to check if a value exists in the "Storage Location" field in that query. I've used the DCount function to do so:
S01Count = DCount("Storage Location", "Query_Reagents_by_Mastername", ["R226-S01"])
If S01Count > 0 Then
Debug.Print ("Exists")
Else
Debug.Print("Does not exist")
End If
But whenever I run it I get the following error
Run-time error 2465: Microsoft Access can't find the field '|1' referred to in your expression.
Does anybody know how I can fix this?
I have tried including the DCount expression directly in the if statement but this results in the same error
Use the correct syntax, like:
S01Count = DCount("*", "[Query_Reagents_by_Mastername]", "[SomeIdField] = 'R226-S01'")