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

Make Line on Report Conditionally Visible?

Hey All,

I’ve reached another aesthetic stumbling block: I have a report that lists all the widgets on Optimus Prime with the fields "Widget Number" and "ID Number" (and some other fields). Sometimes the widgets get ID numbers, and sometimes they don't; the widgets without ID numbers get the value "n/a"--this value is found in the table/query the report is based upon. What I want to happen is have the ID numbers be underlined if they have a value <> “n/a”—just to draw attention to them.

So, I made a line ([Line36]) on the report underneath the text box for [ID Number], made it invisible, and in my code I said:
Expand|Select|Wrap|Line Numbers
  1.     If Me.[ID Number] <> "n/a" Then
  2.                Me![Line36].Visible = True
  3.       End If
The result, however, was a report that showed them all underlined; and, if I changed the code to say = “n/a”, it makes them all invisible. My thought is that Access is seeing that the first record <> “n/a” (which is always the case) and is applying that to the report all the way down through the remaining records.

Is there a way to make this line conditionally invisible? I guess it could apply to any number of format properties: like, if not “n/a” make the value BOLD or ITALICIZED, etc.

thanks,

andy
Apr 21 '10 #1

✓ answered by ADezii

The following code, placed in the Report's Detail Section's Print() Event, should do the trick:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  2.   Me![Line36].Visible = Me![ID Number] <> "n/a"
  3. End Sub

5 9025
NeoPa
32,556 Expert Mod 16PB
See Why Values in Unbound Form Controls do not Persist for why it's behaving as it is.

As a replacement you could look into Conditional Formatting. It should suit your purpose.

Welcome to Bytes!
Apr 22 '10 #2
Thanks, Pa...This all makes sense; sometimes we ask too much. I'll look into the conditional formatting.
Apr 22 '10 #3
NeoPa
32,556 Expert Mod 16PB
Or, put another way, sometimes we don't (yet) know enough to ask the right questions. Experience always helps.
Apr 22 '10 #4
ADezii
8,834 Expert 8TB
The following code, placed in the Report's Detail Section's Print() Event, should do the trick:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
  2.   Me![Line36].Visible = Me![ID Number] <> "n/a"
  3. End Sub
Apr 23 '10 #5
NeoPa
32,556 Expert Mod 16PB
While I wouldn't recommend ADezii's solution over conditional formatting for your current situation, it is the answer to your original question. Hence I've assigned it as the Best Answer.

It's also very interesting information that will probably help you, and others, handle related issues in future.
Apr 23 '10 #6

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

Similar topics

0
by: dwalls | last post by:
If anyone could shed some light on this it would be much appreciated. I have a query that has these rows from an inventory database. BIN, SEG, PARTNO, DESC, COST, ONHAND, COUNTED, VARIANCE,...
2
by: Ryan Liu | last post by:
Hi, What is the best practise to sove this problem: property with defalut value will not be called in auto-generated code ? for example
1
by: ZinksInk | last post by:
How do I make a report display the current record open in a form? This seems like it should be a simple issue however I am strugling to figure out what code SQL / Querry I should use to do this....
0
by: Madhu Subramanya | last post by:
I have a Crystal Report 10 report which i need to use in my app. I use Managed solution for this. There are no compiler or linker problems. I am not able to display this report on the screen but am...
3
by: Naushad | last post by:
Hi All, I am trying to open the report conditionally from the dialogue box form. In the form there are three field. cboEmployees StartDate EndDate I have used these field in criteria to...
1
by: jlcastrejon | last post by:
Hi everybody, Could someone tell me how to make a report using just the last record of my access 2007 database? Tks. Jose
1
by: tur130 | last post by:
On a page using several <area> regions over an <img>, how can you make the <area> regions visible on the rendered web page? The <area> tag apparently supports the style attribute, but I can't find...
1
anoble1
by: anoble1 | last post by:
I am trying to make a report that compares one database to another. Maybe I can make some sense out of this. I am trying to make a query, that actually opens the other database in the background...
0
by: ManSam | last post by:
I have a picture box that is saved to a picture file ".bmp". I inserted the picture in Crystal Report. But when printing, it's not refreshing the new image that's saved in the same file. How can I do...
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
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,...
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
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...
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
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...
0
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...

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.