473,836 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying an image conditional on an Access Report

15 New Member
Hello, I am fairly novice with Access in general ... but do have a decent amount of ability with VBA (mostly through Excel, though).

I'm working on a project that is producing a product catalog through an Access Report, and here is what I am stuck on:

There are advertising banners that they would like to display beneath the main group headers for each product category. We plan on storing these image banners into their own table, and connect to the correct one for the category through there.

The thing is, though, that not all categories will have a banner to display.

I'm assuming a simple check to see if an image exists for the current category would take care of whether the image shows or not ... and adjust the group header's height based on that also.

But which event should I put this code in for it to function correctly?
Dec 9 '11
34 11006
Corey Smith
15 New Member
NeoPa - Sorry about that. The name of the image control is "Image39".

Sierra - The thing that I dont' know how to do is ... at least can't get to work ... is to check for a null value for the image field it'd be based on.
Dec 12 '11 #11
Corey Smith
15 New Member
I'm stumped on how to refer to the field I need to check for null. Am I supposed to create a variable in order to use an IF statement to check for null?

Because when I just refer to it as it's name, I get nothing.
Dec 12 '11 #12
2,322 Recognized Expert Moderator Top Contributor
What I would do is to place the image itself in a supreport. Place the supreport into your group header, and link it the same way you have in the query
[Catalog Import].Code = [Advertising Images].[Catalog Group Codes]
but using the controls Master/Child property instead. Since the supreport will be empty (Now I am assuming that if there is no image, there will also be no record in the Advertising Images table), there will be no record in the supreport, and it will automatically not display. If the supreport control is shrinked as far as possible (height wise) and set to CanGrow, access will do the rest for you.
Dec 12 '11 #13
Corey Smith
15 New Member
There actually will be a record for every Code. That is why I need to be able to check that field to see if it has an image, or not.

It's this way because the categories that will have an image attached varies from version to version.
Dec 12 '11 #14
2,322 Recognized Expert Moderator Top Contributor
Try basing the supreport on a query in which you have a Is Not Null clause on the image field. That should work as well.
Dec 12 '11 #15
32,584 Recognized Expert Moderator MVP
I have Format and Print events in my 2003 reoprt, but S7 indicates that post 2003 the Format event has been renamed to Paint instead. You may need to look into this in more detail.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  4. Private dblHeight As Double
  6. Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
  7.     With Me
  8.         If dblHeight = 0 Then dblHeight = .Image39.Height
  9.         .Image39.Height = IIf(IsNull(.Image39), 0, dblHeight)
  10.     End With
  11. End Sub
The rest of what is required is included in S7's post #10. I would try (test) this approach before resorting to subreports (which may also work, but may be more than you need).
Dec 13 '11 #16
Corey Smith
15 New Member
Thanks NeoPa.

We have 2010 here, and it has both Format and Paint. I've been trying through Format thus far.

I'm about to give what you have above a run and report back!
Dec 13 '11 #17
446 Recognized Expert Contributor
My mistake! Format is still there. They moved it! (That's my excuse)

If you come to specifying heights directly they must be in TWIPS. 1 cm = 567 TWIP

I generally specify sizes in cms then let Access do the multiplication
Expand|Select|Wrap|Line Numbers
  1. Me.Box0.Height = 3 * 567
Dec 13 '11 #18
32,584 Recognized Expert Moderator MVP
That's very useful info S7, but shouldn't be used in this scenario (certainly not if my code forms the basis of the solution). The only values used are 0 and the original value it was set to by the designer, which is saved the first time the event procedure is triggered. This removes the burden of determining the height from the code.
Dec 13 '11 #19
Corey Smith
15 New Member
I'm not having success getting that code to work either. I'm beginning to think that I have set it up incorrectly, initially. Whatever code I put in the On_Format section, I get the space there for the image whether there's an image or not.

How should I have the image control set up? Should I have it's size set initially to 0x0, or set it to the size that all of the images will be (they will all be the same)?

Also, If I'm trying to see if the actual image field (Image) is empty or not ... would referencing the Image Control alone (Image39) tell me that? It seems like if I'm looking at the Height property of Image39, then I'm just looking at the control it self, rather than the image.

I am so confused on this.
Dec 13 '11 #20

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

Similar topics

by: mar10a | last post by:
I am trying to insert a .gif. file into an Access report - using Insert Picture. The original image is 8X11, but access changes the size to 4X6.5. When I change the size of the image in access is puts white border around it and does not change the actual image. Is there a setting I need to change that would allow access to import at the correct size, or do I need to use another file type besides
by: Mike Turco | last post by:
I have an Access database that holds a catalog and one of the fields contains the HTML for the web page. The HTML code is very simple. I would like to be able to display that HTML output on an access report. Is there some kind of control that I can embed into the report so that I can see that HTML? Thanks, Mike
by: emebohw | last post by:
Hey all, weird problem. I cant seem to get a populated text field that has a hyperlink to work when I output my access report to MS office document image writer file. If I stick a 'label' type field on the report and put a url in there and print as msodiw then the hyperlink works. Anyone ever see this? Also, even on the access report, the hyperlink doesnt work correctly. WTH?
by: Parasyke | last post by:
I have a report that I want to print for a product specification sheet with a photo of the product. I have the photos stored in a separate folder from my Access 2000 database. I have a form that when I choose a product all the info for that product appears on the form appropriately, including the image path (e.g. C:\ABCcompany\Prods\Item894654.jpg). The form's data appears appropriately on the report for that item. How can I place an image...
by: kasthuriii | last post by:
Hai everybody i have a project which includes image.i have to store the image in access table using ole control and i have to display that image in crystal report.The important thing is, i must use ole control for storing the image.please help me. Thank u.
by: Saaima | last post by:
Hi All when I store a picture of size 800*600 pixels in database (SqlServer) field Photo (Image) and load it into crystal report through query by dragging and dropping the field on report it appears well but as its size is too large and when i resize it its resolution become so wrong to can not see image. such as in Employee photo in Employee record Actually i need a passport size photo on report. So i save a picture of this size and get...
by: akabir77 | last post by:
Hi I am using the following code to convert a access report into HTML format and then sending it via email. DoCmd.SendObject _ acSendReport, _ "rptQC-Div-email", _ acFormatHTML, _ rs!email, _ , _
by: NJonge01 | last post by:
Greetings, I've read some great advice on similar topics, just nothing matching exactly what I'm trying I'm pretty close I think on making this work, but note quite there. I want to print a report that basically displays photographs. the photographs are located on a web server viewable from my browser. I want to reference the URL and "pull" them into my report at print time TABLE: In a Table, I have a field defined as Hyperlink. ...
by: blees10 | last post by:
Hi Everyone, I am working on an Access report and the client is asking for nitpicky things so I am working on a way to make this work. I have a couple questions and they are not related. 1. I have a date field which I formatted in the Format properties dd" de "mmmm" de "yyyy. I did this so that the date will display as follows: 02 de Febuary de 2008. This works well, but now I need to change the capitalization of Febuary to lower...
by: dbdb | last post by:
hi, i work with ms. access 2003 i want to display image from a folder to the report. i have read thread in http://bytes.com/topic/access/answers/191611-pictures-access-reports but that's for access 2000 i want to set my image picture property, but there is no picture property when i type "image.p " -> no picture property.
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.