0
votes

My table is tbl_WCCSRQA, the relevant fields are CustomerServiceRep and Claim Date.

My form that passes the variables is called frm_CSRErrorTracking, and the relevant boxes are called CSRNameCB (a combo box), and StartDate EndDate (both are text boxes)

My report is called rpt_CSRErrorTracking and I want to set the DCount as a control source for a textbox called TotalClaims

I need a DCount that counts all instance of a CustomerServiceRep name between two dates. I'd like to pass the Name and Dates from my form. I'd like to set the DCount as a control source for the textbox on the report

Here is the DCount I have tried so far;

=DCount("CustomerServiceRep", "tbl_WCCSRQA", "CustomerServiceRep = '" & [Forms]![frm_CSRErrorTracking]![CSRNameCB] & "'" AND "ClaimDate = '" BETWEEN [FORMS]![frm_CSRErrorTracking]![StartDate] AND [FORMS]![frm_CSRErrorTracking]![EndDate]"'"

I've looked at this for the past 30 minutes and cannot figure out where I am going wrong. I continue to get the error message "You may have entered an operand without an operator".

1

1 Answers

0
votes

You have a few double quotes out of sync - try the following:

=DCount("CustomerServiceRep", "tbl_WCCSRQA", "CustomerServiceRep = '" & [Forms]![frm_CSRErrorTracking]![CSRNameCB] & "' AND ClaimDate BETWEEN #" & Format([FORMS]![frm_CSRErrorTracking]![StartDate],"yyyy-mm-dd") & "# AND #" & Format([FORMS]![frm_CSRErrorTracking]![EndDate],"yyyy-mm-dd") & "#")