473,473 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hiding field in report, when value is "0"

27 New Member
In my report, I have 2 weight fields. Sometimes there will only be a value in the first field [GROSS] and then a "0" in the [GROSS 2] field. Rather than showing the "0" in the report, I would like the field to be blank/empty. If I change the criteria for [GROSS 2] at the query level to >0, nothing shows up on the report. Thanks for your help.
Jun 12 '12 #1
6 20615
Mihail
759 Contributor
Use a custom function for those controls:
= IIF([FieldName]=0,"",[FieldName])

I'm not very sure about the syntax but I'm sure about to using the IIF function. Of course, can be other (better) approaches.
Jun 13 '12 #2
rwalle
47 New Member
I usually do it through VBA code in OnOpen Event for the Report something like
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel as Integer)
  2. Dim VisEnable
  3. If Me.Field<1 Then
  4. VisEnable=False
  5. Else
  6. VisEnable=True
  7. End If
  8. Me.FieldName.Visble=VisEnable
  9. End Sub
  10.  
Jun 13 '12 #3
Mihail
759 Contributor
@rwalle
Can you upload an example ?
Jun 13 '12 #4
rwalle
47 New Member
here is a example DB I have MS Acc 2007 it has a report that has fields where the 0 is swaped by a "" and also using conditional formating I have changed the field back color and using a check box in the form that calls the report VBA Code switch visible property of several fields
Attached Files
File Type: zip EjemploDb.zip (61.0 KB, 909 views)
Jun 14 '12 #5
Mihail
759 Contributor
@rwalle
As I expect, your code (post #3) is not an answer for the original question (and can't be).
The answer is the IIF() function (and you use correctly this function in your database).

Also you make a confusion:
(don't be wary: I think that each of us have started with this confusion at the beginning)

A form/report has not fields.
Only tables and queries have fields.
A form/report has controls.
This controls can be (or not) bound to a field (from a table or a query).
So, you can show/hide controls, not fields.

Your code show/hide an unbound control.
As far as I know, this method can't be used for bound controls (that reflect a field in records).
Jun 14 '12 #6
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
The best trick here would be to use the textbox format.

For your textbox boud to [Gross 2] you write in the format property:
Expand|Select|Wrap|Line Numbers
  1. #;\-#;;
The coding for the textbox format is automatically setup to handle different values with different formats. The setup is:
Positive numbers ; Negative Numbers, Zero, Null
And the format property above will shown positive numbers as positive numbers, negative as negative, and it will not display zeros or nulls.
Jun 18 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
1
by: harry | last post by:
Using IE 5.5 (sp2) - no other browser compatability is neccessary! When the user makes a change to a text field I record the "dirty" event in a hidden text field i.e value set to "true". As soon...
1
by: Simon Bailey | last post by:
I currently have a query calculating the gap in days between two dates. The fields being "DateLookedAt" and "DateResolved" plus the calculated field "TimeTaken". I am looking to add another...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
4
by: Tero Partanen | last post by:
Hello! I'm writing about a rather peculiar problem I'm having with Access2000. I have a table in which I have created one hyperlink-type field. I have given the field a default value which is...
12
by: Ola Johansson | last post by:
Can anyone explain to me a meningfull use of the "new" keyword (Shadows in VB). I think i understand how it works fully but i cant figure out why you would use it. Why would you want to declare...
6
by: Dean Slindee | last post by:
I am looking for the "right" way to handle inserting and presenting null date values. Public Const c_NullDate As Date = #12:00:00 AM# If I set the value of a date variable in an SQL Server insert...
3
lwwhite
by: lwwhite | last post by:
Access 2003. I have a form (form view) with a subform (datasheet view). The form has a map_id field and each record on the subform also has a map_id field. I want the fields on the form and subform...
3
by: Galka | last post by:
Hello I worked with a report some time ago, then deleted it. Now when I start the database (Access 2003) it informs me that "Module not found" and opens VBA windows. There in the project frame I...
7
by: TriAdmin | last post by:
I am working with a system that allow me to add custom fields but I can not add OnChange() language to the custom fields. So I want to have a function in the header that recognizes when fieldx is...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.