Hi all:
On Access 2003: I have a tabular form with labels next to the associated fields. I'd like them both to dissappear when the associated field is null. ("Can Shrink" will do this for the field, but the label is still there, so the report does not shrink.)
Any ideas how I can make the label shrink too?
Thanks,
13 44117
Simply change the label to a text box with no backcolor, and set conditional formatting so that if the value is null ( or [control] = "" ), the text is the same color as the background. You will want to lock and disable the text box so the text can't be selected when it is not supposed to be visible.
Thanks.
Actually, I found a different answer: I changed the label to a text box and set the control source to iif(isnull([related control]),null,"Label Title"). Then I set the Can Shrink properties for the label and the related to control to Yes.
Thank you for sharing your solution. That's probably a much better idea, since I've experienced slow updating with conditional formatting.
NeoPa 32,554
Expert Mod 16PB
Each section in a report has a Format event. You could handle this without any special usages of controls simply by setting the .Visible property of both controls to (Not IsNull(Me.Control)).
Ah, I was thinking of continuous forms. Would the Format event work in that case? Forgive my laziness in not trying it myself, but I think it's quicker to ask.
NeoPa 32,554
Expert Mod 16PB @ChipR
Not at all. Happy to answer.
I believe the Format event is specific to Report sections and is not available anywhere I can find for forms.
NeoPa,
I admit I'm baffled. (I'm only a programmer by circumstance, not by training.) Note, I'm using Access 2003.
1: What's the "Format event". Is that the format tab in the properties of the form?
2: I can't put that code in dialog box for Is Visible -- it limits me to Yes and No
Can you explain? Thanks.
NeoPa 32,554
Expert Mod 16PB
I will be happy to. Unfortunately, I will need to be careful to explain it in terms that make sense to you which will take time I don't have immediately available.
If you see nothing by tomorrow bump the thread and I'll post a proper explanation.
NeoPa,
Thanks for the offer, but it's not necessary; I have a solution that works. But if you're willing to give me 3 or 4 minutes, (and no more) I'd like to understand where to put the code you suggest -- do I go into code builder and build a sub called control_format(...); if so, is it attached to the control or to the form definition?
Thanks,
Dante
NeoPa 32,554
Expert Mod 16PB
OK. Here goes. A little intro to programming in VBA and the structures you can work with.
Most code in VBA is instigated by events. There are various objects (such as forms; reports; controls on either forms or reports; etc; etc). Typically objects have various events associated with them. An event can be considered as a trigger for starting specific relevant code - generally termed an Event Handler Procedure.
I won't go into too much detail of all the possible events for all the possible objects as they are really far too numerous to mention. To put this in context though, a report has various sections, each of which has a Format event associated with them. Forms don't have any objects with a Format event as far as I'm aware, so this should be considered exclusively for reports.
When assigning code to an event, what you need to do is the following (to start you off right) : - Open the containing object in Design Mode (if the object is a form or report then it won't be contained).
- Select the object (control; section; etc).
- Show Properties and select the Event from the list.
- The value will have a drop-down and the value "[Event Procedure]" will be available. Select this and click on the ellipsis button to the right.
- This will switch to the IDE (Integrated Development Environment) and create a procedure shell for you to populate with your code.
Thank you NeoPa. You helped me find the one piece of the puzzle that I was missing. I'd been looking for the events associated with the controls, or at the form level, but not at the detail section level. Now I see the "on Format" event.
Thanks again.
Dante
NeoPa 32,554
Expert Mod 16PB
Pleased to help Dante, though still a little curious that you refer only to Forms when talking about the Format event. You do appreciate that this is fundamentally Report related rather than anything to do with Forms as such?
My mistake; I meant reports.
Thanks again
Sign in to post your reply or Sign up for a free account.
Similar topics
by: c.anandkumar |
last post by:
Hi All -
I have some problems getting a small piece of javascript working
correctly for Firefox. Here is what I am trying to do -
1. I have a form (like a search form)
2. I have many groups...
|
by: Galina |
last post by:
Hello
I have a report, which lists records. Each record has money paid
field. Money paid can be 0 or not 0. I calculate and print summary of
money for a group in the group footer, as well as...
|
by: Colin McGuire |
last post by:
Hi, I have an report in Microsoft Access and it displays everything in
the table. One column called "DECISION" in the table has either 1,2,
or 3 in it. On my report it displays 1, 2, or 3. I want...
|
by: Max ©® |
last post by:
Hi all, I'm going crazy...
I've report with subreport.
I want simply move some objects on report and subreport according to
fields value. For example I want hide a label when a field is empty.
...
|
by: Coll |
last post by:
I have a field that I would like to display on a report only if the
value of another field matches a certain criteria. If it does match I
need the label & the field value to display (though I'm...
|
by: prakashwadhwani |
last post by:
Hi !! I'm about to develop a new project for a client.
Should I go about it in Access 2003 or 2007 ? Purchasing it either
for me or for my client is not a major consideration here ... what I'd...
|
by: zufie |
last post by:
I receive the # Error when I run my Mailing Label report.
I generated the report using Label Wizard.
The # Error appears in the Name field portion of the Label.
My report is based on a...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
| |