On No Data

lmcc007

Registered User.
Local time
Today, 13:45
Joined
Nov 10, 2007
Messages
635
I have an Image21.Visible = No on the main report that I want displayed if there is no phone number for a record. On rsubTelephone report I went to On No Data and entered:

Code:
Reports!rptCompanyProfile.Image21.Visible = True

but it does nothing.

Should I set this up another way?
 
So on the same report some records will have a phone number and some won't?
 
Do you remember the db we worked on that had an attachment field? It had a paper clip image. Use the same concept.
 
Do you remember the db we worked on that had an attachment field? It had a paper clip image. Use the same concept.

No, I don't. I tried pulling up a couple of dbs but they were not the one. I know I did it, but just don't remember. Let me search some more.
 
Well, considering that I answer alot of questions per day and I remember your question from 5 months (or so) ago, I think you should somehow remember it was done.

Anyway, the idea is to return a Null path IIF() phone number is null.
 
Just remember NO DATA means for the entire report, not for individual fields.

So, I guess vbaInet had helped you with another display of something so you would probably follow the lead for this with that.

I'll just mention for anyone who pops in here in the future - to display something based on a value or lack of value in a record, you need to use the On Format event of the section where the control is located. And if you want it to display in Report View (for Access 2007/2010) as well as Print Preview and Print, you would need to also use the On Paint function. You can build a single function in the form module and then call it in both places.
 
Well, considering that I answer alot of questions per day and I remember your question from 5 months (or so) ago, I think you should somehow remember it was done.

Anyway, the idea is to return a Null path IIF() phone number is null.

Unfortunately, my memory is not that great like yours :)! I know I did something but I can't remember what db or form or report. It'll come back to me as I move a long.
 
Just remember NO DATA means for the entire report, not for individual fields.

So, I guess vbaInet had helped you with another display of something so you would probably follow the lead for this with that.

I'll just mention for anyone who pops in here in the future - to display something based on a value or lack of value in a record, you need to use the On Format event of the section where the control is located. And if you want it to display in Report View (for Access 2007/2010) as well as Print Preview and Print, you would need to also use the On Paint function. You can build a single function in the form module and then call it in both places.

I've never used the On Paint function. Do you have example of this that you can post that I can see visually?
 
I've never used the On Paint function. Do you have example of this that you can post that I can see visually?

The On Paint event is just the same as the On Format event but it applies to Access 2007 and 2010's REPORT VIEW (which was new in 2007).
 
Unfortunately, my memory is not that great like yours :)! I know I did something but I can't remember what db or form or report. It'll come back to me as I move a long.
You need to eat lots of fish :)

All I did was look at the threads you posted. You can do the same too.

http://www.access-programmers.co.uk/forums/showthread.php?t=196693

You will see how the paper clip was visible in some records and not visible in another. The work was done in the query where it returned a Null path when there was no attachment. I know it's a form but the same concept applies.

Or like Bob mentioned you can perform the check in the section's Print event.
 
Or like Bob mentioned you can perform the check in the section's Print event.

I never said Print Event. I said On Format and On Paint events. There is a difference in how they act.
 
With Reports you have to remember that you need to test and set the Image to Visible or Not each time as the report simply re-iterates the image from the previous record. Your Image setting is conditional for every record.

Simon
 
I think it's a much neater and more efficient way to set the path accordingly in the record source instead of setting the Visible property in code. Here's what I mean. So in the query:
Code:
Alias: IIf(IsNull([PhoneNumber]), Null, "C:\Documents and Settings\lmcc007\Desktop\myImage.bmp")
Alias will become the Control Source of the image control.

Obviously this will work if the image control is borderless.
 
vbaInet,

You are quite correct. However, I would still set the Image Control to Invisble/Visible for each record. My experience has been with Reports is the Image is dragged from one record to another if an image does not exist.

Simon
 
vbaInet,

Access may have changed, but in Access 1997 if set the ImageControl dynamically, Stock Record 1 = 1.jpg etc, if anyone of the Stock records didn't have an Image the last Stock Record's Image was used instead. That was not right so hence setting the Imagecontrol to Invisible. to be honest since this has worked since Access 1997, we have an adage, if it works don't touch it.

Simon
 
I can't remember if that's the case with 2000 but I'm almost certain that post 2002 doesn't have that problem. Definately 2007 and 2010 don't, those I'm sure of. I think that was a limitation with 1997.
 

Users who are viewing this thread

Back
Top Bottom