Connecting Tech Pros Worldwide Forums | Help | Site Map

HELP I need Conditional Fields on report

JC Mugs
Guest
 
Posts: n/a
#1: Nov 12 '05
I have a report coming from a query that I need to print.

Question: I want to have fields print or not print on a value of one of
the fields... Like this-

IF Doz2 >0 then Print Doz2

Meaning if the field Doz2 is more than 0 then print the number. I also hope
to use this same check for additional fields in the line of the report. The
fields are not a subreport or a part of a table.

In the report the record prints like this

Doz1 CPrice1 CDescription1 CExt1 (which is a
calculated field Doz1*CPrice1)
Doz2 CPrice2 CDescription2 CExt2
.... and so on.

I seem to have seen this somewhere, but have not been able to find it..

Thanks JC



Larry Linson
Guest
 
Posts: n/a
#2: Nov 12 '05

re: HELP I need Conditional Fields on report


The easiest way is to use a Format statement that prints blank for a zero
value. The format specification has three parts: the first specifies the
format for a positive value; the second specifies the format for a negative
value; the third specifies the format for a zero value -- in this third
part, using " " will do what you want:

Format ("#,##0.00";"-#,##0.00";" ")

would be a format of this type.

You could do more work, and in the Print event use an If statement to set
the Visible property of _each_ Control...

If Me!txtDoz1 <> 0 Then
Me!txtDoz1.Visible = True
Else
Me!txtDoz1.Visible = False
End If

Larry Linson
Microsoft Access MVP


"JC Mugs" <jcmugs@hotmail.com> wrote in message
news:10094t1sa9vv340@corp.supernews.com...[color=blue]
> I have a report coming from a query that I need to print.
>
> Question: I want to have fields print or not print on a value of one of
> the fields... Like this-
>
> IF Doz2 >0 then Print Doz2
>
> Meaning if the field Doz2 is more than 0 then print the number. I also[/color]
hope[color=blue]
> to use this same check for additional fields in the line of the report.[/color]
The[color=blue]
> fields are not a subreport or a part of a table.
>
> In the report the record prints like this
>
> Doz1 CPrice1 CDescription1 CExt1 (which is a
> calculated field Doz1*CPrice1)
> Doz2 CPrice2 CDescription2 CExt2
> .... and so on.
>
> I seem to have seen this somewhere, but have not been able to find it..
>
> Thanks JC
>
>[/color]


Mike Storr
Guest
 
Posts: n/a
#3: Nov 12 '05

re: HELP I need Conditional Fields on report


Use the IIF function in the ControlSource of the field, and set it's value
to "" if it =0
=IIF(Doz2 >0,"",Doz2)

You will probably need to do something similar in the CExt fields where if
Doz is "" then the calculation is not performed. Otherwise it will return an
error.

Mike Storr
www.veraccess.com



"JC Mugs" <jcmugs@hotmail.com> wrote in message
news:10094t1sa9vv340@corp.supernews.com...[color=blue]
> I have a report coming from a query that I need to print.
>
> Question: I want to have fields print or not print on a value of one of
> the fields... Like this-
>
> IF Doz2 >0 then Print Doz2
>
> Meaning if the field Doz2 is more than 0 then print the number. I also[/color]
hope[color=blue]
> to use this same check for additional fields in the line of the report.[/color]
The[color=blue]
> fields are not a subreport or a part of a table.
>
> In the report the record prints like this
>
> Doz1 CPrice1 CDescription1 CExt1 (which is a
> calculated field Doz1*CPrice1)
> Doz2 CPrice2 CDescription2 CExt2
> .... and so on.
>
> I seem to have seen this somewhere, but have not been able to find it..
>
> Thanks JC
>
>[/color]


Lyle Fairfield
Guest
 
Posts: n/a
#4: Nov 12 '05

re: HELP I need Conditional Fields on report


"JC Mugs" <jcmugs@hotmail.com> wrote in
news:10094t1sa9vv340@corp.supernews.com:
[color=blue]
> I have a report coming from a query that I need to print.
>
> Question: I want to have fields print or not print on a value of one
> of the fields... Like this-
>
> IF Doz2 >0 then Print Doz2
>
> Meaning if the field Doz2 is more than 0 then print the number. I also
> hope to use this same check for additional fields in the line of the
> report. The fields are not a subreport or a part of a table.
>
> In the report the record prints like this
>
> Doz1 CPrice1 CDescription1 CExt1 (which is
> a calculated field Doz1*CPrice1)
> Doz2 CPrice2 CDescription2 CExt2
> .... and so on.
>
> I seem to have seen this somewhere, but have not been able to find it..
>
> Thanks JC[/color]

in the format property try

"#0.00","-#0.00","",""

the four parts are

positives, negatives, zeros, nulls

you can add colors as
"-#0.00"[Red]

mess with this until it shows what you want.

I would point out to you, however, that zero should be shown as 0 (zero),
and nothing should not be shown. Nothing is not zero. Nothing is not
Nothing. Nothing is nothing.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Closed Thread