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

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(Cancel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown1C.Visible = False
Me.lblBreakdownsC.Visible = False
Else
Me.txtBreakdown1C.Visible = True
Me.lblBreakdownsC.Visible = True
End If
End Sub
Nov 12 '05 #1
3 2185
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(Cancel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown1C.Visible = False
Me.lblBreakdownsC.Visible = False
Else
Me.txtBreakdown1C.Visible = True
Me.lblBreakdownsC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown1C 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.txtBreakdown1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdownsC.Visible = (strBreakdowns1 = strEmpty)
Nov 12 '05 #2
Dom
Salad <oi*@vinegar.com> wrote in message news:<vt*****************@newsread1.news.pas.earth link.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(Cancel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown1C.Visible = False
Me.lblBreakdownsC.Visible = False
Else
Me.txtBreakdown1C.Visible = True
Me.lblBreakdownsC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown1C 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.txtBreakdown1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdownsC.Visible = (strBreakdowns1 = strEmpty)

Hi Salad,

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

As for my main problem I'm still stumped! The value of
Me.txtBreakdown1C 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.com> wrote in message news:<vt*****************@newsread1.news.pas.earth link.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(Cancel As Integer)

Dim strEmpty As String
strEmpty = ""

Dim strBreakdowns1 As String
strBreakdowns1 = Me.txtBreakdown1C.Value

If strBreakdowns1 = strEmpty Then
Me.txtBreakdown1C.Visible = False
Me.lblBreakdownsC.Visible = False
Else
Me.txtBreakdown1C.Visible = True
Me.lblBreakdownsC.Visible = True
End If
End Sub


What is the value of Me.txtBreakdown1C 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.txtBreakdown1C.Visible = (strBreakdowns1 = strEmpty)
Me.lblBreakdownsC.Visible = (strBreakdowns1 = strEmpty)


Hi Salad,

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

As for my main problem I'm still stumped! The value of
Me.txtBreakdown1C 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(Cancel As Integer, FormatCount As Integer)
Me.Code.Visible = (Right(Me.ID, 1) = 0)
End Sub
I will assume Me.txtBreakdown1C is a text field on your report and not
from the calling form. Every record where Me.txtBreakdown1C 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(Cancel As Integer, FormatCount As Integer)
Me.txtBreakdown1C.Visible = (Me.txtBreakdown1C.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
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...
1
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...
1
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...
2
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
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...
2
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...
2
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...
2
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...
6
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...
1
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...
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: 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
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:
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...
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
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...

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.