iff statement did not work

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

Guest

Below is how I handle the IIf statement on the mainframe report writer.
Can you help me convert this expression into Access. Do I have to create a
Query to handle it, or can I do it all in the report as in the mainframe
reportwriter.

--- ----- -----------
These calculations are done prior to record read
5,00 1 3 LOACNT=0
5,00 2 3 EXTCNT=0
5,00 3 4 COLOA=0
5,00 4 4 COEXT=0
These calculations are done after record read
5,00 100 RECCNT=sum(1)
5,00 101 If emstcd='LOA' then LOACNT=loacnt+1 else LOACNT=LOACNT
5,00 102 If EMSTCD='EXT' then EXTCNT=EXTCNT+1 else EXTCNT=EXTCNT
5,00 103 If EMSTCD='LOA' then COLOA=COLOA+1 else COLOA=COLOA
5,00 104 If EMSTCD='EXT' then COEXT=COEXT+1 else COEXT=COEXT

Above calcs are done in group footer.
 
I either a group or report footer or header, you could use control sources
like:

=Sum(Abs([EMSTCD]="LOA"))
=Sum(Abs([EMSTCD]="EXT"))
 
Thanks Duane, that worked with a lot fewer steps than the mainframe. What
would be the simplest way to sum those two fields. I tried

=sum(abs([EMSTCD]="LOA")) + (abs([EMSTCD]="EXT"))

above control only gave me the first total, not the sum of the two?
--
vickilynn


Duane Hookom said:
I either a group or report footer or header, you could use control sources
like:

=Sum(Abs([EMSTCD]="LOA"))
=Sum(Abs([EMSTCD]="EXT"))


--
Duane Hookom
MS Access MVP
--

Vicki Leatherberry said:
Below is how I handle the IIf statement on the mainframe report writer.
Can you help me convert this expression into Access. Do I have to create
a
Query to handle it, or can I do it all in the report as in the mainframe
reportwriter.

--- ----- -----------
These calculations are done prior to record read
5,00 1 3 LOACNT=0
5,00 2 3 EXTCNT=0
5,00 3 4 COLOA=0
5,00 4 4 COEXT=0
These calculations are done after record read
5,00 100 RECCNT=sum(1)
5,00 101 If emstcd='LOA' then LOACNT=loacnt+1 else LOACNT=LOACNT
5,00 102 If EMSTCD='EXT' then EXTCNT=EXTCNT+1 else EXTCNT=EXTCNT
5,00 103 If EMSTCD='LOA' then COLOA=COLOA+1 else COLOA=COLOA
5,00 104 If EMSTCD='EXT' then COEXT=COEXT+1 else COEXT=COEXT

Above calcs are done in group footer.
 
=sum(abs([EMSTCD]="LOA")) + Sum(abs([EMSTCD]="EXT"))
or possibly
=sum(abs(Instr("EXT~LOA",[EMSTCD])>0))
or
=sum(abs([EMSTCD]="LOA" OR [EMSTCD]="EXT"))

--
Duane Hookom
MS Access MVP
--

Vicki Leatherberry said:
Thanks Duane, that worked with a lot fewer steps than the mainframe. What
would be the simplest way to sum those two fields. I tried

=sum(abs([EMSTCD]="LOA")) + (abs([EMSTCD]="EXT"))

above control only gave me the first total, not the sum of the two?
--
vickilynn


Duane Hookom said:
I either a group or report footer or header, you could use control
sources
like:

=Sum(Abs([EMSTCD]="LOA"))
=Sum(Abs([EMSTCD]="EXT"))


--
Duane Hookom
MS Access MVP
--

Vicki Leatherberry said:
Below is how I handle the IIf statement on the mainframe report
writer.
Can you help me convert this expression into Access. Do I have to
create
a
Query to handle it, or can I do it all in the report as in the
mainframe
reportwriter.

--- ----- -----------
These calculations are done prior to record read
5,00 1 3 LOACNT=0
5,00 2 3 EXTCNT=0
5,00 3 4 COLOA=0
5,00 4 4 COEXT=0
These calculations are done after record read
5,00 100 RECCNT=sum(1)
5,00 101 If emstcd='LOA' then LOACNT=loacnt+1 else
LOACNT=LOACNT
5,00 102 If EMSTCD='EXT' then EXTCNT=EXTCNT+1 else
EXTCNT=EXTCNT
5,00 103 If EMSTCD='LOA' then COLOA=COLOA+1 else COLOA=COLOA
5,00 104 If EMSTCD='EXT' then COEXT=COEXT+1 else COEXT=COEXT

Above calcs are done in group footer.
 

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

Back
Top