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

Home Posts Topics Members FAQ

How to add image control

5 New Member

I've created on a form an event to create a new report. I've almost done but can't solve one problem with newly created image control in the report.

I have a source with image path but i couldn't find solution how to add this path info to the control.

Below is the part of my code. I receive error on 15th line: "Run-time error'438': object doesn't support this property or method". Please give some advises.

Expand|Select|Wrap|Line Numbers
  1. Dim txtPhotoID As Access.Image
  3. Set rpt = CreateReport
  4. strReportName = rpt.Name
  6. title = "Report1"
  7. DoCmd.RunCommand acCmdDesignView
  9. rpt.RecordSource = "SELECT ImagePathlink FROM test1;"
  11. Set txtPhotoID = CreateReportControl(rpt.Name, acImage, _
  12.          acGroupLevel2Header, , , 200, 200)
  13.          txtPhotoID.SizeToFit
  14.          txtPhotoID.Name = "CatgPhoto"
  15.          rpt.Controls("CatgPhoto").ControlSource = "ImagePathlink"
Mar 7 '12 #1
10 12612
11 New Member
You can't bind an Image control to a datasource, you could try a bound Object control instead
Mar 7 '12 #2
5 New Member
Thanks for your reply ChrisPadgham
I'm not very advanced programmer. I'm not sure where to change and how to change my image to bound object :(
I've tried only this

rpt.Controls("C atgPhoto").Pict ure= "ImagePathl ink"

But received message "can't open the file "ImagePathlink" . In this case I understand that "ImagePathl ink" is unserstood as the path of file. By the way I use Access 2007.
Mar 8 '12 #3
759 Contributor
I assume that ImagePathlink is a variable where you store the full path for your image. So the quotes are not necessary:
Expand|Select|Wrap|Line Numbers
  1. rpt.Controls("CatgPhoto").Picture= ImagePathlink
This is one face of your problem. I think that will not solve your main problem: To show pic in the report.

I post now for subscribe purpose but I'll try to solve your problem because is an interesting one.
Mar 9 '12 #4
759 Contributor
This work very well for me (see attachment) with no programming.
Of course you must customize the addresses.

Let me know if this is what you are looking for or I misunderstand your problem.
Attached Files
File Type: zip PicturesInReport.zip (21.8 KB, 533 views)
Mar 9 '12 #5
5 New Member
Thank for your help. Your example do not help me in this case. If I leave my code only to create image control without adding any control source (ImagePathlink) and then I go to the new created report and insert a control source ImagePathlink - I see pictures. The problem is I don't know how to create report and "tell" in the creation code to put control source.
Mar 10 '12 #6
759 Contributor
Thanks (again) to MMcCarthy : http://bytes.com/topic/access/insigh...port-using-vba

I can develop this code:

Expand|Select|Wrap|Line Numbers
  1. Dim rpt As Report
  2.     Set rpt = CreateReport
  3.     With rpt
  4.         .Caption = "Report1"
  5.         .RecordSource = "SELECT ImagePathlink FROM test1;"
  6.     End With
  8.     DoCmd.RunCommand acCmdDesignView
  10. Dim imgPhotoID As Access.Image
  12. Set imgPhotoID = CreateReportControl(rpt.Name, acImage, _
  13.          acDetail, , "ImagePathlink", 200, 200)
  14.          imgPhotoID.SizeToFit
  16. 'This approach give me an error because -acGroupLevel2Header- not because "ImagePathlink"
  17. 'Set imgPhotoID = CreateReportControl(rpt.Name, acImage, _
  18. '         acGroupLevel2Header, , "ImagePathlink", 200, 200)
  19. '         imgPhotoID.SizeToFit
Mar 10 '12 #7
5 New Member
Thank you for your reply. I made changes according to your comments but when I look at the created report - no picture source is attached. I added my code.
Attached Files
File Type: zip CreateReport.zip (76.9 KB, 193 views)
Mar 15 '12 #8
759 Contributor
I can't open your database. I use 2007.

Sorry but I can't see any reason to don't work for you.
Now I attach the database. You must change the pics addresses according to your pictures paths.
Attached Files
File Type: zip PicturesInReport.zip (39.5 KB, 276 views)
Mar 15 '12 #9
5 New Member
Sorry, If you think that I want you to do my work, I put database to show that your code doesn't work in my case. In your example I changed the path of image and after I pressed button "Create report", I received white paper - no images. I can send you a printscreen to if you are interested in. But anyway. thank you for your assitants, I will try to solve this problem in other way. Thank you again.
Mar 16 '12 #10

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

Similar topics

by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following error when trying to hit one of my pages... --------------------------------------------------------------------- Invalid URI: There is an invalid sequence in the string. ---------------------------------------------------------------------
by: Arnold | last post by:
Hey there, I've browsed for some fixes to this but only found a couple of similar posts, which didn't solve my problem. I'm wondering how to refresh an image control in a form after a user clicks a cmd button to open the Windows API Common Dialog and selects a new file (jpeg). Images are initially loaded in the form's oncurrent event. I've tried using me.dirty = false to make the form current. Has anyone experienced this before?
by: Scott Simonson | last post by:
Sorry if this posts twice. I can only assume that my previous post didn't because I attached a small image to it to show the error. I have had an application in MSAccess 2k for about year now without issues until today. My users were using it in W98 without issue, but recently moved to WindowsXP and now are getting an error. It is with the standard image control while loading a TIF image. Loading these TIFs in W98 works but not in...
by: Tim Marshall | last post by:
Is this possible does anyone know? I mean other than using imaging software. The scenario is this. I have a form with a large image control over which is imposed a grid of squares (label controls with transparent backgrounds). The image control is a map (user chooses a map or image in previous forms). The idea is to use the on click event of a label to bring up another form into which comments, etc, can be stored about that area of...
by: Jake | last post by:
I am a beginner in C# and web controls. I need a way to load an image which is stored in an Access (mdb) field into an Image control added at runtime. I get the image (jpg format) dynamically at runtime then I create an Image control (from WebControls collection) and add it to the page also at runtime. The ImageUrl property needs a URL string but I only have the image itself extracted with a data RecordSet (recordset for example.) Can...
by: David W. Simmonds | last post by:
I have a DataList control that has an Image control in the ItemTemplate. I would like to resize the image that goes into that control. I have a series of jpg files that are full size, full resolution (ie. large). I have a database that contains references to the pictures. Currently I have to resize the jpgs manually, and then point the ImageUrl property at that jpg using databinding. This works fine. I would like to avoid the resizing step...
by: Suraj Joneja | last post by:
Hi All, I've an image control on my ASP.net page. This displays an image named 'Logo.jpg' in the location '~\Images'. Another application can change this image. It can select any image and upload to the folder 'Images' and newly selected image would overwrite existing image 'Logo.jpg'. (Image name remains same and image changes). The image control on my page doesn't refresh the newly selected image. it displays the old image where as the...
by: Brian | last post by:
Using A2K I have an image control on a report and use code to set the image.picture to the required jpg. 3 of the jpgs resize properly but 2 do not - they display much smaller than the image control. The problem jpgs were originally created as line drawings in Word. They were then copy and pasted to Paint where they were saved as jpg files. Sizemode is set to stretch.(have tried clip and zoom but no better). I cannot find any way to...
by: SayamiSuchi | last post by:
hi I have taken one image control("image1") in the form("frmForm1.aspx").Now i want to one image ("mypic.jpeg") whose size is larger than the image control i.e image1.When i run the program, the image control takes the size of the image mypic.jpeg.But what i want is that the image mypic.jpeg fit in the image control along with its size.I mean the image mypic.jpeg should expand if it's size is smaller than image control and should contract if...
by: Lou O | last post by:
I have browsed and seen several posts on the subject but my issue seems to be unique. I have an image control on a form that updates on the after update event of a list box on the control. For each each item in the list box there is a corresponding jpg image displayed. Moving through the list items displays each corresponding image correctly. Double clicking the list box opens an editing form that can change the image. If the image is...
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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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: 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.