psullivan348
New member
- Local time
- Today, 07:51
- Joined
- Oct 23, 2009
- Messages
- 4
I can not get the AND statement to work with DSUM
Here is my scenerio:
table: tblActualExpense
Fields Involved:
SchoolNumber (Primary Key) Combo box looks up from tblSchool
FiscalYear (Primary Key) Long Integer Number
QtrNumber (Primary Key) Long Integer Number
TotalTeacherCompensation Currency
form: frmSchoolActualExpenses
SchoolNumber (Unbound Combo box) lookup
subform: subSchoolActualExpenses
FiscalYear (Unbound Combo Box) lookup
QtrNumber (Unbound Combo Box) lookup
TeacherCompensation
Okay, now I have that all right. Everything comes from where it is supposed to and life is good, until....
I need to have another column of YTD information that needs filter by school and total all the Fiscal year for the selected year.
I have tried many, many things but got half way there with DSUM.
This is what I have:
=nz(DSUM(TotalTeacherCompensation","tblActualExpenses", "FiscalYear= &[FiscalYearHere] AND SchoolNumber= &Forms![subSchoolActualExpenses]![FiscalYearHere]&")
when I break them apart and link to one or the other it works fine. It is a issue with the AND and I just want to be done with this!!!!!! Or maybe it has to do with one being on the main form and the other being on the sub form. I have no idea but I sure want to.
If there is a easier way to do this, please help or point me into the right direction.
Thanks very much for whatever help I can get!!!!!







Here is my scenerio:
table: tblActualExpense
Fields Involved:
SchoolNumber (Primary Key) Combo box looks up from tblSchool
FiscalYear (Primary Key) Long Integer Number
QtrNumber (Primary Key) Long Integer Number
TotalTeacherCompensation Currency
form: frmSchoolActualExpenses
SchoolNumber (Unbound Combo box) lookup
subform: subSchoolActualExpenses
FiscalYear (Unbound Combo Box) lookup
QtrNumber (Unbound Combo Box) lookup
TeacherCompensation
Okay, now I have that all right. Everything comes from where it is supposed to and life is good, until....
I need to have another column of YTD information that needs filter by school and total all the Fiscal year for the selected year.
I have tried many, many things but got half way there with DSUM.
This is what I have:
=nz(DSUM(TotalTeacherCompensation","tblActualExpenses", "FiscalYear= &[FiscalYearHere] AND SchoolNumber= &Forms![subSchoolActualExpenses]![FiscalYearHere]&")
when I break them apart and link to one or the other it works fine. It is a issue with the AND and I just want to be done with this!!!!!! Or maybe it has to do with one being on the main form and the other being on the sub form. I have no idea but I sure want to.
If there is a easier way to do this, please help or point me into the right direction.
Thanks very much for whatever help I can get!!!!!