Need help with the "dsum" function.

F

FatMan

Background:
What I am trying to do is calculate a total for a field in a query that
meets the criteria set by the criteria argument of the dsum funtion. The
criteria is that the value of the field is only to be summed when the
production date equals the date entered on the form.

Error Message:
Syntax error (missing operator) in query expression '[JobStartDate]='

Details:
Query name: qryApplesKgUsed
Query field name: JobStartDate
Query field to be totaled: KgIssued
Form name: frmDailyProduction
Form field name: txtProductionDate
Syntax of funtion: =DSum("[KgIssued]","[qryApplesKgUsed]","[JobStartDate]="
& [Forms]![frmDailyProduction]![txtProductionDate])

If any one can help me I would greatly appreciate it.

Thanks,
FatMan
 
T

Tom Lake

Error Message:
Syntax error (missing operator) in query expression '[JobStartDate]='

Details:
Query name: qryApplesKgUsed
Query field name: JobStartDate
Query field to be totaled: KgIssued
Form name: frmDailyProduction
Form field name: txtProductionDate
Syntax of funtion: =DSum("[KgIssued]","[qryApplesKgUsed]","[JobStartDate]="
& [Forms]![frmDailyProduction]![txtProductionDate])

If any one can help me I would greatly appreciate it.

If [Forms]![frmDailyProduction]![txtProductionDate] is null, you'd get that error.
Also, if [JobStartDate] is a Date field, you have to do this:

=DSum("[KgIssued]","[qryApplesKgUsed]","[JobStartDate]=#" &
[Forms]![frmDailyProduction]![txtProductionDate] & "#")

Tom Lake
 
F

FatMan

Tom:
Thanks. Putting the "#" around the control "txtProductionDate" worked as it
is a date field. Didn't know that you needed to put the "#" around controls
defined as a date fields but should have since access automatically adds them
in the querry by example grid. Dough!!!!

Thanks,
FatMan

Tom Lake said:
Error Message:
Syntax error (missing operator) in query expression '[JobStartDate]='

Details:
Query name: qryApplesKgUsed
Query field name: JobStartDate
Query field to be totaled: KgIssued
Form name: frmDailyProduction
Form field name: txtProductionDate
Syntax of funtion: =DSum("[KgIssued]","[qryApplesKgUsed]","[JobStartDate]="
& [Forms]![frmDailyProduction]![txtProductionDate])

If any one can help me I would greatly appreciate it.

If [Forms]![frmDailyProduction]![txtProductionDate] is null, you'd get that error.
Also, if [JobStartDate] is a Date field, you have to do this:

=DSum("[KgIssued]","[qryApplesKgUsed]","[JobStartDate]=#" &
[Forms]![frmDailyProduction]![txtProductionDate] & "#")

Tom Lake
 

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


Top