Variable Field on A report

J

jbruen

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.
 
D

Duane Hookom

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],...)
 

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

Top