iff statement did not work

V

Vicki Leatherberry

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

Duane Hookom

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

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

Vicki Leatherberry

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

Duane Hookom

=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.
 
Top