DCount Error

M

Marshall Barton

DS said:
I have this DCount on a Report Header it pulls the Dates from 2 fields
on a form. I'm getting an #Error....

=Nz(DCount("CheckID","tblChecks","ChkBizDay


You need to use complete comparisons:

=Nz(DCount("CheckID","tblChecks",
"ChkBizDay >= Forms!frmReportDates!TxtStart
AND ChkBizDay <= Forms!frmReportDates!TxtEnd"), 0)

Or use the Between operator:

=Nz(DCount("CheckID","tblChecks",
"ChkBizDay BETWEEN Forms!frmReportDates!TxtStart
AND Forms!frmReportDates!TxtEnd"), 0)
 
F

fredg

Sorry Inaccurate DCount,
Here is the corrected version....

=Nz(DCount("CheckID","tblChecks","ChkBizDay >=
Forms!frmReportDates!TxtStart AND <= Forms!frmReportDates!TxtEnd AND
PAID=-1&"),0)

Still doesn't work!
Thanks,
DS

Is ChkBizDay a Date datatype?
You need to repeat the criteria field for each criteria as well as
surround the variable value with the date delimiter symbol "#".

=Nz(DCount("*","tblChecks","[ChkBizDay] >= #" &
Forms!frmReportDates!TxtStart & "# AND [ChkBizDay] <= #" &
Forms!frmReportDates!TxtEnd & " AND PAID=-1"),0)

Also make sure the name of the control is not the same as the name of
any field used in the control source expression. The form must also be
open when the report is run.
 
D

DS

I have this DCount on a Report Header it pulls the Dates from 2 fields
on a form. I'm getting an #Error....

=Nz(DCount("CheckID","tblChecks","ChkBizDay
=Forms!frmReportDates!TxtStart AND <=Forms!frmReportDates!TxtEnd"),0)

Any Help is appreciated.
Thanks
DS
 
D

DS

DS said:
I have this DCount on a Report Header it pulls the Dates from 2 fields
on a form. I'm getting an #Error....

=Nz(DCount("CheckID","tblChecks","ChkBizDay

Any Help is appreciated.
Thanks
DS
Sorry Inaccurate DCount,
Here is the corrected version....

=Nz(DCount("CheckID","tblChecks","ChkBizDay >=
Forms!frmReportDates!TxtStart AND <= Forms!frmReportDates!TxtEnd AND
PAID=-1&"),0)

Still doesn't work!
Thanks,
DS
 
D

DS

fredg said:
Sorry Inaccurate DCount,
Here is the corrected version....

=Nz(DCount("CheckID","tblChecks","ChkBizDay >=
Forms!frmReportDates!TxtStart AND <= Forms!frmReportDates!TxtEnd AND
PAID=-1&"),0)

Still doesn't work!
Thanks,
DS


Is ChkBizDay a Date datatype?
You need to repeat the criteria field for each criteria as well as
surround the variable value with the date delimiter symbol "#".

=Nz(DCount("*","tblChecks","[ChkBizDay] >= #" &
Forms!frmReportDates!TxtStart & "# AND [ChkBizDay] <= #" &
Forms!frmReportDates!TxtEnd & " AND PAID=-1"),0)

Also make sure the name of the control is not the same as the name of
any field used in the control source expression. The form must also be
open when the report is run.
Got a Syntax Error
So I did this, Then got "Cancelled previous operation.

=Nz(DCount("*","tblChecks","[ChkBizDay] >= #" &
Forms!frmReportDates!TxtStart & "# AND [ChkBizDay] <= #" &
Forms!frmReportDates!TxtEnd & "# AND PAID=-1"),0)

Thanks
DS
 
D

DS

Marshall said:
DS wrote:





You need to use complete comparisons:

=Nz(DCount("CheckID","tblChecks",
"ChkBizDay >= Forms!frmReportDates!TxtStart
AND ChkBizDay <= Forms!frmReportDates!TxtEnd"), 0)

Or use the Between operator:

=Nz(DCount("CheckID","tblChecks",
"ChkBizDay BETWEEN Forms!frmReportDates!TxtStart
AND Forms!frmReportDates!TxtEnd"), 0)
It works! I just can't seem to get the ChkPaid=-1 added though. When I
add it I et an Error!
Thanks
DS
 
D

DS

DS said:
It works! I just can't seem to get the ChkPaid=-1 added though. When I
add it I et an Error!
Thanks
DS
Got It!

=Nz(DCount("CheckID","tblChecks",
"ChkBizDay BETWEEN Forms!frmReportDates!TxtStart
AND Forms!frmReportDates!TxtEnd AND ChkPaid=-1"), 0)

Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DCount In Otherdb 27
Criteria Mismatch 4
Same data from 2 sources 2
Syntax Error 4
DCount Syntax 2
UNION QUERY (Sorting) 2
UNION SELECT Problem 2
From External Database 5

Top