473,396 Members | 2,055 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,396 software developers and data experts.

Hide a checkbox on a report if its value is false

In the detail section of a report I want to hide a checkbox control and it's label if the value of the control is false. I sort of expected the following to work.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.       If Me.CheckBox1 = True then
  3.             Me.CheckBox1.Visible = True
  4.       Else
  5.             Me.CheckBox1.Visible = False
  6.       End If
  7.       'or, more obscurely, in one line "Me.CheckBox1.Visible = Me.CheckBox1"
  8. End Sub
  9.  
However, it DOESN'T!! The code has no effect at all. If I replace it by just one line ...

Expand|Select|Wrap|Line Numbers
  1.       Me.CheckBox1.Visible = False    'just for experimental purposes
  2.  
... again, the code seems to have no effect at all. Check box still there!!!
I'm sure (thinking back to my ancient Access 2003 days) I was able to do this conditional report formatting once upon a time. This granny possibly approaching senility.
Mar 20 '10 #1

✓ answered by patjones

In asking my question, I was trying to get at when exactly this event runs.

For the mock report that I made, I found that the event runs when you hit "Print Preview", but it does not seem to run when you simply "Open" the report.

So, when I inserted the code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.  
  3. Me.chkTest.Visible = Me.chkTest
  4.  
  5. End Sub

I found that it worked fine in Print Preview and Export to PDF. But it did not work with Open.

Pat

4 4015
patjones
931 Expert 512MB
Hi juliet -

If you could do one little thing, which is to insert

Expand|Select|Wrap|Line Numbers
  1. MsgBox "Hello"

somewhere in the subroutine, and then try running it again, this might shed light on the problem. I think it might be possible that your subroutine isn't even running; whether the message box shows up or not will tell us if that is the case.

Pat
Mar 20 '10 #2
Thnaks ... that is a good idea, but actually I already tried it! The sub is running, but not doing what I told it!!! I'll let you know if/when I solve the problem.
Mar 22 '10 #3
NeoPa
32,556 Expert Mod 16PB
@julietbrown
Disobedient procedures!! Shock! Horror!

Have you tried tracing through the code (Debugging in VBA) Juliet, to determine which actual lines of code are executing, and if the specific line is executing, what is happening?
Mar 22 '10 #4
patjones
931 Expert 512MB
In asking my question, I was trying to get at when exactly this event runs.

For the mock report that I made, I found that the event runs when you hit "Print Preview", but it does not seem to run when you simply "Open" the report.

So, when I inserted the code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2.  
  3. Me.chkTest.Visible = Me.chkTest
  4.  
  5. End Sub

I found that it worked fine in Print Preview and Export to PDF. But it did not work with Open.

Pat
Mar 22 '10 #5

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

Similar topics

9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
12
by: ATS | last post by:
I need to hide/reveal parts of a web page using javascript. I think I can do with using the <span> tag, but I've been away from it for a while and don't remember. Any pointers, examples?
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
2
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine...
2
by: UJ | last post by:
Is there a way with a asp:checkbox to run a JavaScript to display/hide text/input on the screen without doing a postback? I also need to be able to access the stuff at the server so I need to...
1
by: asilverpeach | last post by:
Hey Guys! Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out. First, In the following code clicking on the headers shows the...
10
by: sara | last post by:
Hi - Is it possible to hide the detail section of a report at run time? I have a report that prints all details, with summary lines. The user would like the report ALSO with just summary lines....
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
0
Frinavale
by: Frinavale | last post by:
This code snippet is just a little bit of fun. It demonstrates how you use JavaScript and CSS to show or hide columns in a table depending on whether or not a checkbox corresponding with the...
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.