473,771 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visibility of controls in a Sub-Report

Dom
Hi,

I have a werid problem with a subreport. If someone can help me out
I'd be very grateful!

Based on results from a query, the visibility of textboxes and labels
in a subreport are set to true or false. Some sample code is below. It
all looks straight foward however the desired output does not happen.
To makes things even more strange when I load the Print Preview of the
subreport and then switch to the Design View of the subreport and then
switch back to the Print Preview the correct information is shown. For
some reason it does not load correctly on the first time. Werid!

Has anyone any ideas?

Many Thanks,
Dom

Private Sub Report_Open(Can cel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown 1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown 1C.Visible = False
Me.lblBreakdown sC.Visible = False
Else
Me.txtBreakdown 1C.Visible = True
Me.lblBreakdown sC.Visible = True
End If
End Sub
Nov 12 '05 #1
3 2210
Dom wrote:
Hi,

I have a werid problem with a subreport. If someone can help me out
I'd be very grateful!

Based on results from a query, the visibility of textboxes and labels
in a subreport are set to true or false. Some sample code is below. It
all looks straight foward however the desired output does not happen.
To makes things even more strange when I load the Print Preview of the
subreport and then switch to the Design View of the subreport and then
switch back to the Print Preview the correct information is shown. For
some reason it does not load correctly on the first time. Werid!

Has anyone any ideas?

Many Thanks,
Dom

Private Sub Report_Open(Can cel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown 1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown 1C.Visible = False
Me.lblBreakdown sC.Visible = False
Else
Me.txtBreakdown 1C.Visible = True
Me.lblBreakdown sC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown 1C when you open a report? Is that
value on the detail line? You might want to place your code somewhere
else...like the detail band's OnFormat event. Do you want this to occur
on every line or for the entire report?

Here is something else I also do on statements line yours.
Me.txtBreakdown 1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdown sC.Visible = (strBreakdowns1 = strEmpty)
Nov 12 '05 #2
Dom
Salad <oi*@vinegar.co m> wrote in message news:<vt******* **********@news read1.news.pas. earthlink.net>. ..
Dom wrote:
Hi,

I have a werid problem with a subreport. If someone can help me out
I'd be very grateful!

Based on results from a query, the visibility of textboxes and labels
in a subreport are set to true or false. Some sample code is below. It
all looks straight foward however the desired output does not happen.
To makes things even more strange when I load the Print Preview of the
subreport and then switch to the Design View of the subreport and then
switch back to the Print Preview the correct information is shown. For
some reason it does not load correctly on the first time. Werid!

Has anyone any ideas?

Many Thanks,
Dom

Private Sub Report_Open(Can cel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown 1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown 1C.Visible = False
Me.lblBreakdown sC.Visible = False
Else
Me.txtBreakdown 1C.Visible = True
Me.lblBreakdown sC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown 1C when you open a report? Is that
value on the detail line? You might want to place your code somewhere
else...like the detail band's OnFormat event. Do you want this to occur
on every line or for the entire report?

Here is something else I also do on statements line yours.
Me.txtBreakdown 1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdown sC.Visible = (strBreakdowns1 = strEmpty)

Hi Salad,

thanks very much for your reply! I like your neat tip on assigning
true/false to the control.....ver y nice!

As for my main problem I'm still stumped! The value of
Me.txtBreakdown 1C will be either an empty string or some letter. When
its an empty string I want to hide it and when its a letter I show it.
The onformat event made no differance.

I want this formatting to occur for the whole report. There is only
one record displayed per page so if the next record is selected then
the formatting should occur again. There doesn't seem to be any events
to control this in reports. (the onChange event is for forms only)

The other thing I can't explain is why when I switch in and out and
the design view a couple of times the correct data eventually shows
up! I'm stumped!

Any further advice is much appreciated!

Thanks,
Dom
Nov 12 '05 #3
Dom wrote:
Salad <oi*@vinegar.co m> wrote in message news:<vt******* **********@news read1.news.pas. earthlink.net>. ..
Dom wrote:

Hi,

I have a werid problem with a subreport. If someone can help me out
I'd be very grateful!

Based on results from a query, the visibility of textboxes and labels
in a subreport are set to true or false. Some sample code is below. It
all looks straight foward however the desired output does not happen.
To makes things even more strange when I load the Print Preview of the
subreport and then switch to the Design View of the subreport and then
switch back to the Print Preview the correct information is shown. For
some reason it does not load correctly on the first time. Werid!

Has anyone any ideas?

Many Thanks,
Dom

Private Sub Report_Open(Can cel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown 1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown 1C.Visible = False
Me.lblBreakdown sC.Visible = False
Else
Me.txtBreakdown 1C.Visible = True
Me.lblBreakdown sC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown 1C when you open a report? Is that
value on the detail line? You might want to place your code somewhere
else...like the detail band's OnFormat event. Do you want this to occur
on every line or for the entire report?

Here is something else I also do on statements line yours.
Me.txtBreakdown 1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdown sC.Visible = (strBreakdowns1 = strEmpty)


Hi Salad,

thanks very much for your reply! I like your neat tip on assigning
true/false to the control.....ver y nice!

As for my main problem I'm still stumped! The value of
Me.txtBreakdown 1C will be either an empty string or some letter. When
its an empty string I want to hide it and when its a letter I show it.
The onformat event made no differance.

I want this formatting to occur for the whole report. There is only
one record displayed per page so if the next record is selected then
the formatting should occur again. There doesn't seem to be any events
to control this in reports. (the onChange event is for forms only)

The other thing I can't explain is why when I switch in and out and
the design view a couple of times the correct data eventually shows
up! I'm stumped!

Any further advice is much appreciated!

Thanks,
Dom


I created a junk report with 2 fields; ID and Code. I only want to
display the Code if the rightmost character is 0. So this is my code line

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
Me.Code.Visible = (Right(Me.ID, 1) = 0)
End Sub
I will assume Me.txtBreakdown 1C is a text field on your report and not
from the calling form. Every record where Me.txtBreakdown 1C is empty
you don't want to display the label. You can select the label then cut
it. Then click on the associated field and paste it. Now the label and
textbox are associated. You only need to make invisible the textbox now.

Now, cut/paste this code into your report
Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
Me.txtBreakdown 1C.Visible = (Me.txtBreakdow n1C.Visible > "")
End Sub

This should work. Cut out any other previous attempts to make this
visible or invisible.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7932
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the same control. Is there anyone who has tried this before and knows why this is hapenning ??
1
2071
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the buttons allow me to toggle between the textbox and the dropdownlist. This works fine when the control is placed on the page but when it is placed inside a datalist, ie the itemtemplate, the onclick events for the buttons fire but the visibility...
1
6394
by: Micky Pearce | last post by:
Hi I have a page containing a hidden <div> called 'controls' plus an <iframe> containing a second page. I need to be able to set the visibility of the 'controls' div when the page in the iframe loads. Is this possible? Using this code I can change the visibility from a link in the parent window: onClick="document.getElementById('controls').style.visibility='visible'"
2
4032
by: John | last post by:
Hi all, How do I iterate through a specific placeholder and remove or hide all controls contained within that placeholder? Regards John.
4
1793
by: Alexandre Soares | last post by:
Hi, If I make a control that derives from panel, how can I persist the state of the controls that are inside the panel when it is not rendered (visible = false)? The reason for this is that I'm making a custom user control that derives from the Panel class. In the render method, I render some stuff and then I do base.render if the panel is to be visible. If it's to be hidden, I don't render it, but when I render it again, the controls...
2
1426
by: Michel Couche | last post by:
Hello! I am working on an on-line ASP.Net library. I would like to set up the visibility of some controls programmatically. My approach is to give an "admin_" prefix to some controls and to define their visibility by the procedure below .... Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load .....
2
4004
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the IIS Server of my Workstation (Win XP) with a text box, button and required field validator, this works fine. If I create the same page on the IIS6 Windows 2003 Server the validation control doesn't stop the post. I've tried different browsers and...
2
2309
by: Roman | last post by:
I have built a simple user control that contains 2 buttons, a text box and a dropdownlist. When a button is clicked it sets the visible property of the textbox/dropdownlist and the button. ie the buttons allow me to toggle between the textbox and the dropdownlist. This works fine when the control is placed on the page but when it is placed inside a datalist, ie the itemtemplate, the onclick events for the buttons fire but the visibility...
6
2038
by: Nick Stansbury | last post by:
Hi, I have a loop running on Page_PreRender that sets a number of controls to invisible based on a set of criteria. Before I do this however, I set all of the drop down lists to be visible with a straightforward recursive loop. Now - I'm really muddled by this - why does this: If TypeOf Ctl Is DropDownList Then Ctl.Visible = true End If
1
1645
by: YotamElal | last post by:
Hello, I have a popup problem. When a popup is opened, I want all other popups to close immediatly. (except for its self and it's child popups) Here is my code: code: <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> <html>
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7460
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.