Variable Field on A report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with a column with totals for every month of the year. I
created a query with one of the fields being the month passed from the form.
I tried to create a field on the form with a calculation of:
=IIf([MyMonth]="January",[JanAct],IIf([MyMonth]="February",[FebAct],IIf([MyMonth]="Marh",[MarAct],IIf([MyMonth]="April",[AprAct],IIf([MyMonth]="May",[MayAct],IIf([MyMonth]="June",[JunAct],IIf([MyMonth]="July",[JulAct],IIf([MyMonth]="August",[AugAct],IIf([MyMonth]="September",[SepAct],IIf([MyMonth]="October",[OctAct],IIf([MyMonth]="November",[NovAct],IIf([MyMonth]="December",[DecAct])))))))))))) where MyMonth contains the month on the form and I get an error.
 
You should consider normalizing your table structure.
I don't see any reference to a form or control in your syntax. I consider
nesting more than two IIf()s unacceptable.

If you really want to keep your table structure and if you have a form with
a combo box for the month number, consider an expression like:

=Choose(Forms!frmA!cboMthNumber,[JanAct],[FebAct],[MarAct],...)
 
Back
Top