major problem with IIF function

  • Thread starter Thread starter Reno
  • Start date Start date
R

Reno

Hey all

I have a gradebook for my students and I have a form that has a sub form
showing all students, one student at a tme with all their results . these
results are broke into two criteria Alpha and beta. in the footer I have the
a txtbox(alpha1) that sums all the marks in the alpha field for that student
and a txtbox(beta1)that sums all the marks in the beta field for that
student. but I now need it to on sum the alpha field if a semester field =1
but my attempt,which is in the control source of txtbox(alpha1)

=SUM( IIf(([Sem])=1,[alpha],0) )

doesnt work. Any ideas gives me an #error in txt(alpha1)

thank you

Cheers
 
I just tried this, without the extra parenthesis around [Sem],
=SUM(IIf([Sem]=1,[alpha],0)), and it worked. Is [Sem] a field in the form's recordset? If
it isn't, you may want to check the DSum function. If it is, do you have both a control
and a field named SEM on the form? If so, try changing the name of the control. If it is a
textbox, try changing the control's name to txtSEM.
 
Hey
Wayne it still does not work . to answer your question the main form is
based on a query that selects the students and the sub form is based on a
tblresults and semester is a field in that tbl

cheers
damien
Wayne Morgan said:
I just tried this, without the extra parenthesis around [Sem],
=SUM(IIf([Sem]=1,[alpha],0)), and it worked. Is [Sem] a field in the form's recordset? If
it isn't, you may want to check the DSum function. If it is, do you have both a control
and a field named SEM on the form? If so, try changing the name of the control. If it is a
textbox, try changing the control's name to txtSEM.

--
Wayne Morgan


Reno said:
Hey all

I have a gradebook for my students and I have a form that has a sub form
showing all students, one student at a tme with all their results . these
results are broke into two criteria Alpha and beta. in the footer I have the
a txtbox(alpha1) that sums all the marks in the alpha field for that student
and a txtbox(beta1)that sums all the marks in the beta field for that
student. but I now need it to on sum the alpha field if a semester field =1
but my attempt,which is in the control source of txtbox(alpha1)

=SUM( IIf(([Sem])=1,[alpha],0) )

doesnt work. Any ideas gives me an #error in txt(alpha1)

thank you

Cheers
 
You simply say "in the footer." Where are these controls/fields located. Are some on the
main form and some on the subform? If so, which ones are where?
 
Back
Top