By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,831 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,831 IT Pros & Developers. It's quick & easy.

HELP I need Conditional Fields on report

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <jc****@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
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

Nov 12 '05 #2

P: n/a
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" <jc****@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
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

Nov 12 '05 #3

P: n/a
"JC Mugs" <jc****@hotmail.com> wrote in
news:10*************@corp.supernews.com:
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


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)
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.