I have a report in Access 2003. If I set the can shrink property on the textboxes they are invisible when they are empty, which is what I want. But it does not hide the associated label connected to it. Is that possible to do, either with vba or visual basic 6?
Thanks
12 42702
Use for each field this code in the Detail's On Print event: - Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
-
If Len(Nz(Me.YourField)) > 0 Then
-
Me.Label1.Visible = True
-
Else
-
Me.Label1.Visible = False
-
End If
-
End Sub
This will hide (and free the space) the label.
Nic;o)
NeoPa 32,511
Expert Mod 16PB
I have a report in Access 2003. If I set the can shrink property on the textboxes they are invisible when they are empty, which is what I want. But it does not hide the associated label connected to it. Is that possible to do, either with vba or visual basic 6?
Thanks
To nick some of Nico's answer shamelessly (I wouldn't have thought of the Detail_Print event, but maybe the OnCurrent event would have worked as well) : - Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
-
Me!YourField.Visible = (Me!YourField>"")
-
End Sub
I simply set the Visible property of the TextBox as this will handle both automatically assuming they're linked. The code is shorter but perhaps a little less obvious to the casual reader. The Visible property is set to the boolean value returned by the equation.
To be clear, this is an alternative, not a fix, to Nico's code, which will work fine for you.
I have a similar issue and used the code provided to hide the labels of the fields with no data. I have another question, is there a way to shrink the white space so the fields compact together--as it is, the fields are hidden, but it is like there is space reserved for the fields (they are just do not appear, but have enough space on the report to appear)...
To shrink the white space you'd have to use code to either A) Move all controls over, expressed in twips or B) Set the X,Y coordinates for all the controls you want to move, expressed in twips.
For A, use: - Me.Control.Move Left, [Top], [Width], [Height]
For B, use: - Me.Control.Left = #
-
Me.Control.Top = #
To shrink the white space you'd have to use code to either A) Move all controls over, expressed in twips or B) Set the X,Y coordinates for all the controls you want to move, expressed in twips.
For A, use: - Me.Control.Move Left, [Top], [Width], [Height]
For B, use: - Me.Control.Left = #
-
Me.Control.Top = #
Sorry, this is all new to me, I will try the Me.Control.Move Left, [Top],[Width]...etc, but is the "Me" part the name of the label or field? and the "Top", "Width" is expressed in inches?
Me is a reference to the form. Replace Control with the name of the control you want to move. Replace Left, Right, Height, Width with numbers expressed in twips (twip: Unit of measurement that is equal to 1/20 of a point, or 1/1,440 of an inch. There are 567 twips in a centimeter.)
So, if you have a text box named Foo and you need to move it 567 twips to the left, which is one centimeter, then you would use:
Top-Left is coordinate (0,0)
That makes sense...one last question, which section of the VB code does this go in, (Detail Print?)
I'd put it in whichever Sub is hiding the labels.
Thanks, I will give it a try.
I'd put it in whichever Sub is hiding the labels.
Hi, I am trying to do the same thing as TinyTim but I am having problems. The invisible part works, but moving the text gives me an error. Here is what I have, can you tell me what I'm doing wrong? - If Len(Nz(Me.app)) > 0 Then
-
Me.app1.Visible = True
-
Else
-
Me.app1.Visible = False
-
Me.app1.Move Top - 567
-
End If
NeoPa 32,511
Expert Mod 16PB
Try : - If Len(Nz(Me.app)) > 0 Then
-
Me.app1.Visible = True
-
Else
-
Me.app1.Move Top - 567
-
Me.app1.Visible = False
-
End If
If this doesn't work, then post the question in a new thread.
This thread is not for your question.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dalan |
last post by:
I have been using a module for printing labels in Access 97, and
although it works fine, I would like to add a small enhancement to it.
The module...
|
by: Rohan |
last post by:
Hi There,
Is it possible to rotate or resize pictureboxes, labels, textboxes at runtime?
And I even wanted to make textbox and label...
|
by: jyothi1105 |
last post by:
Hi,
I want to add textboxes and labels at runtime. Controls are to be added according to the value entered in textbox.
txtfamily is a textbox,in...
|
by: DAnDA |
last post by:
Hi
Simply i want Hide all Textboxes in a Panel ,,, in asp.net
i can do it by C# :
foreach (Control ctrl in Panel1.Controls)...
|
by: DAnDA |
last post by:
Hi
Simply i want Hide all Textboxes in a Panel ,,, in asp.net
i can do it by C# :
foreach (Control ctrl in Panel1.Controls)
{
if (ctrl is...
|
by: nev |
last post by:
After adding a datasource, I can see my tables in the right-pane of my IDE. Some tables I placed on my form as a datagrid and others as detail view...
|
by: englishman69 |
last post by:
Hello,
I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my...
|
by: sahilansari |
last post by:
I have two Radio buttons. radio_date & radio _reg.
Initially radio_date is checked by default.(On form load)....So i want to display two textboxes...
|
by: Bay0519 |
last post by:
Hi,
I really need someone help..
I'm using access 2003 by the way.
I have a form where users enter their time card. right now I have 15 lines...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| |