473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HELP I need Conditional Fields on report

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
3 2098
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jayjay | last post by:
When it comes to access, I'm pretty good using the built in features and can come up with some pretty complex functions to get what I need. But we have this database I'm doing for work that is...
0
by: JC Mugs | last post by:
I have an Access XP project that is to print checks. There are a couple of lines of fields that should not print when the values are 0. Such as Doz2 =0 then Item should not print, It is...
4
by: Wayne Aprato | last post by:
I have a simple database which was originally written in Access 97. When converted to Access 2000 file format it ran flawlessly in Access 2002. I've just tried to run it in Access 2003 and I am...
1
by: MHenry | last post by:
Hi, I have a table with duplicate records. Some of the duplicates need to be eliminated from the table and some need not. A duplicate record does not need to be eliminated if the one record...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
1
by: ammarton | last post by:
Hello all...I'm a bit new to working with Macros in Access so forgive me if the terminology I use is not accurate. To preface this, basically I am using a form on a replicated database so the...
1
by: access baby | last post by:
Hi Below mention is the reply from Salad on my query i created a crosstab query and form not based on any table of qurey but this doesnt work . I somehow have missed something actually i have too...
0
by: RCapps | last post by:
When running the below SQL Query I keep getting the following error: Server: Msg 4924, Level 16, State 1, Line 1 ALTER TABLE DROP COLUMN failed because column 'ContractDef' does not exist in table...
3
by: DeanL | last post by:
Hi guys, I'm in need of a little help with a report I'm setting up on Access 2000. The report shows data depending on entries on a form that has 7 fields (Min and Max Cost, Fiscal Year, Min and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.