I'm trying to do a DCount but am getting a #Name? error. I'm trying to find the number where command = to A1 in the query Q_WO_Outstanding. Is the syntax wrong?
=DCount([Command],[Q_WO_Outstanding],[Command]="A1")
I'm trying to do a DCount but am getting a #Name? error. I'm trying to find the number where command = to A1 in the query Q_WO_Outstanding. Is the syntax wrong?
=DCount([Command],[Q_WO_Outstanding],[Command]="A1")
Hi -
Yes, the syntax is wrong. Change it to:
=DCount([Command],[Q_WO_Outstanding],"[Command]='A1'")
The whole criteria string has to be in quotation marks, and because A1 is also a string, it has to be in its own set of quotation marks as well. Single quotes or double quotes both work, but if you use double-quotes, it has to look like this:
=DCount([Command],[Q_WO_Outstanding],"[Command]=""A1""")
John
It still shows the error. This is in a report. The report has no Record Source because I will be referencing 3 seperate queries. When I added the queries in the Record Source as a SQL query it kept locking up the report. Will the report be able to read Q_WO_Outstanding without some kind of link in the record source?
Hi -
That depends on what you mean by "read" the query. The error you are getting may not be related to the DCount, but to how you are using it. In what context are you using it in your report?
John
Basically, I have a unbound field where I want the results of a count of all the A1 commands in the Q_WO_Outstanding query.
One easy way is to use the On Format event of the report section where you have the unbound field:
FieldName = DCount([Command],[Q_WO_Outstanding],"[Command]=""A1""")
John
There are actually multiple fields. I've attached an example without the tables to give you an idea what I am doing. Each field will have a count referencing a command (A1, A2, A3, A4, A5 or A6) and a query (Outstanding, In Progress or Resolved). Hopefully this helps.
I can't open the file, because I only have A2003. But no matter.
In theory, then, you can have 18 DLookup's ( 6 commands x 3 queries) to fill 18 report fields. That should not present any problems that I can see. Each is independant of the others.
John
I changed it to a 2003 format. I guess I'm confused as to how to do the multiples. Do I still use the Format Event?
I've found a solution in using Sum with and IIf statement. I broke each section down into individual sub reports to reference the individual queries.
Thank you for your help.