473,382 Members | 1,349 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,382 software developers and data experts.

Conditional Visibility Impossible?

Hi There...thanks for reading...

In a report I have designed in Access 2007, I am attempting to make a grouping footer section (which contains fields which sum up totals for data in the details) become invisible when the description control/field equals "". The "description" field is in the header section for the same grouping which is wrapped around the "detail" section.

Here is the code I am using in the On Print event of the footer section...

Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
GroupFooter0.Visible = IIf(description.Value = "", False, True)
End Sub

I have tried so many variants of the code above, I think I may never get it to work. No matter what I do the footer section will not stop displaying... :-(

Please help!
Aug 10 '07 #1
6 7839
JConsulting
603 Expert 512MB
Hi There...thanks for reading...

In a report I have designed in Access 2007, I am attempting to make a grouping footer section (which contains fields which sum up totals for data in the details) become invisible when the description control/field equals "". The "description" field is in the header section for the same grouping which is wrapped around the "detail" section.

Here is the code I am using in the On Print event of the footer section...

Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
GroupFooter0.Visible = IIf(description.Value = "", False, True)
End Sub

I have tried so many variants of the code above, I think I may never get it to work. No matter what I do the footer section will not stop displaying... :-(

Please help!
try using the On_format event for that section.
Also
Try adjusting the height of that section, vs the visibility. Make sure you have your Can Shrink properties of each control in that section set to yes, same for the section itself.
J
Aug 10 '07 #2
try using the On_format event for that section.
Also
Try adjusting the height of that section, vs the visibility. Make sure you have your Can Shrink properties of each control in that section set to yes, same for the section itself.
J
Hi J,

Thanks for writing back... I tried both of your suggestions but was still unable to get it to work.

I have tried sticking in a bit code to test the value description.Value:

MsgBox(description.Value) but I get an error saying this is an invalid use of Null. However, when I use this code...

MsgBox(IIf(description.Value = Null, "Null", "Not"))

...the message box comes us with "Not"

Any ideas?
Aug 11 '07 #3
ADezii
8,834 Expert 8TB
Hi There...thanks for reading...

In a report I have designed in Access 2007, I am attempting to make a grouping footer section (which contains fields which sum up totals for data in the details) become invisible when the description control/field equals "". The "description" field is in the header section for the same grouping which is wrapped around the "detail" section.

Here is the code I am using in the On Print event of the footer section...

Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
GroupFooter0.Visible = IIf(description.Value = "", False, True)
End Sub

I have tried so many variants of the code above, I think I may never get it to work. No matter what I do the footer section will not stop displaying... :-(

Please help!
It's simply the Syntax and nothing but the Syntax. In the Format() NOT Print() Event of the Group Header, place the following code. Let me know how you make out.
Expand|Select|Wrap|Line Numbers
  1. Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
  2.   If Me.Section(acGroupLevel1Header).Controls("description") = "" Then
  3.     Me.Section(acGroupLevel1Footer).Visible = False
  4.   Else
  5.     Me.Section(acGroupLevel1Footer).Visible = True
  6.   End If
  7. End Sub 
Aug 11 '07 #4
JConsulting
603 Expert 512MB
It's simply the Syntax and nothing but the Syntax. In the Format() NOT Print() Event of the Group Header, place the following code. Let me know how you make out.
Expand|Select|Wrap|Line Numbers
  1. Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
  2.   If Me.Section(acGroupLevel1Header).Controls("description") = "" Then
  3.     Me.Section(acGroupLevel1Footer).Visible = False
  4.   Else
  5.     Me.Section(acGroupLevel1Footer).Visible = True
  6.   End If
  7. End Sub 

to add to ADz's comment here....to cover all bases

[code]
1.
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
2.
If NZ(Me.Section(acGroupLevel1Header).Controls("descr iption"),"") = "" Then
3.
Me.Section(acGroupLevel1Footer).Visible = False
4.
Else
5.
Me.Section(acGroupLevel1Footer).Visible = True
6.
End If
7.
End Sub
Aug 11 '07 #5
Hello ADezi and J,

Thank you so much for your help...

It worked! Using the full description of the objects focused it in and by adding the Nz I stopped the Nulls (which refuse to show up in the tester MsgBox function) from propagating through the function. My final code was as follows...

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If Nz(Me.Section(acGroupLevel2Header).Controls("descr iption")) = "" Then
Me.Section(acGroupLevel2Footer).Visible = False
Else
Me.Section(acGroupLevel2Footer).Visible = True
End If
End Sub

I can't thank you enough! :-)
Aug 13 '07 #6
JConsulting
603 Expert 512MB
Hello ADezi and J,

Thank you so much for your help...

It worked! Using the full description of the objects focused it in and by adding the Nz I stopped the Nulls (which refuse to show up in the tester MsgBox function) from propagating through the function. My final code was as follows...

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If Nz(Me.Section(acGroupLevel2Header).Controls("descr iption")) = "" Then
Me.Section(acGroupLevel2Footer).Visible = False
Else
Me.Section(acGroupLevel2Footer).Visible = True
End If
End Sub

I can't thank you enough! :-)

Youre welcome. and by the way..you should change this line as shown below.

If Nz(Me.Section(acGroupLevel2Header).Controls("descr iption"),"") = "" Then

J
Aug 14 '07 #7

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

Similar topics

3
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification...
28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
34
by: BQ | last post by:
Hello Is there a way to declare 'FUNCT' via a define so that if its parameter x, a constant, is greater than 35, it returns 56, if not, 20. I would like that at compile time, not at run time. ...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
2
by: Richard Frenkel | last post by:
In scripting languages such as PHP and ColdFusion, it is easy to conditionally include a block of html using something like (pseudocode): <if x=true> This is some <b>random html<b> that gets...
1
by: BIOSMonkey | last post by:
I am trying to develop a drop down menu control. I know there are many other scripts out there but I need to develop our own in house for licensing purposes. Anyway, I am in the beginning stages...
44
by: petermichaux | last post by:
Hi, I have been using the following line of code to create an object called "Serious" if it doesn't already exist. if (Serious == null) {var Serious = {};} This works in the scripts I use...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
3
by: smuir | last post by:
I am working with a basic access form for a payroll system and need to modify it such that if an employee worked overtime, then their overtime payrate and hours show up on the report below their...
10
by: Lyn | last post by:
Hi, I would like to make a bound text box not visible if it is empty (not just disable it). This option is not available from the standard conditional formatting feature (at least, not that I can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.