473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting null image.Picture property

I'm working on distributing a database using VS Tools for Office, and
am having trouble with linked images on forms/reports. The image
objects have a default path\file set on the .Picture property, which
becomes invalid when the user installs the database (ie: c:\devpath\
becomes c:\program files\mydbapp, but the .Picture property still
points to c:\devpath\) The problem is that I don't *know* what
installation path the user will select, so I can't hard-code a path
into the property. I technically can't even use "c:\dummy.j pg" because
I don't know the user has a drive c:\.

The forms/reports themselves work fine in print preview, as the
image.Picture property is set via VBA code to show the correct image
for that record. But when opening the database and opening the
forms/reports with linked image objects *in design view*, I get a
series of "can't open the file" errors. Errors when opening in design
view I can live with, since print preview works. But errors during
startup are not acceptable. I suspect it's the design-view errors
appearing during startup for some reason, so I think once one problem
is fixed, the other will be fixed as well.

I've read that some people recommend creating image objects with
Picture="(none) " or "", but Access 2003-SP2 won't let me do that. It
forces me to choose an image file, so I load in a dummy/default image
that ends up being replaced in VBA. (ie: c:\devpath\dumm y.jpg)

I've tried updating the image.picture property for each object On-Open
so it points to a valid path, but that doesn't work; I still get "can't
open the file" errors. My guess is that design-view doesn't trigger
on-open.

I've tried updating the link to a valid devpath\filenam e then removing
the path from the .Picture property (since the helpfiles indicate the
Path is optional for the .Picture property). It seems to work, and it
appears as if only the filename is saved. I can then open/close/design
the report w/o any problems. But if I close the database, rename my
devpath directory, and open the database, it says it can't find the
images when I go back to that same report in design view. If I open the
report in design view and fix the first image so it references the new
path (leaving the others so they just reference the filename), then
*all* images on the report in design view show the default/dummy image
properly. Very odd. Is there a report property to define a "default
directory" for searching for images w/o paths?

I've also tried using system variables, code, and a custom function in
the .Picture box, with no success. ie: currentproject. path &
"\dummy.jpg " or %windir%\dummy. jpg or DefaultDir()
It seems like the .Picture property can only contain a uninterpreted
string.

Is there a way to set an image object so its .Picture property is
null/(None)/""?
Is there a way to type code into the .Picture property?
Is there some other solution to this quandary?

May 8 '06 #1
4 12844
Answering my own question...

I decided to work on the problem some more. Here is my solution.

For each Linked image in each form/report, set it as Embedded, and
..Picture=c:\du mmy.jpg, which is a 256byte 1x1 pixel image. (I didn't
bother optimizing by setting color depth, etc... 256byte is good enough
for now.)

Then in VBA, immediately before setting the .Picture property to load
the correct image for the record, set .PictureType=1, which I
understand to be "linked".

In theory this switches the report/form to use a linked reference to
whatever file I want, but the saved report design contains an embedded
dummy image to avoid the "file not found" problem I encountered during
startup and design-view.

Since it is embedded, the file c:\dummy.jpg can be deleted and the
c:\devpath directory can be renamed w/o any problems. I tested it, and
all error messages are gone. Yay!

Will my solution cause any problems with a slow bloat over time? Am I
properly only "linking" to images, or will Access use the saved
"embedded" setting to absorb the image data over time? If that happens
it's definitely a problem, as my image archive for this project is
about 40MB at this point. I ran through one of the reports in
print-preview that accesses most of the images, and I didn't notice any
bloat in the db FE. It looks like a working solution.

Even though I answered the question myself, I welcome any and all
input/comments/corrections.

May 8 '06 #2
It won't bloat unless you store the images in the database as OLE
objects OR you allow changes to the forms to be saved in any view (see
AllowDesignChan ges property for the forms).

If you are binding these images to the controls at run-time, anyway,
I'd suggest using a CurrentProject. Path call to provide the Path string
to the image folder to eliminate your path change problems after the
app is installed on the client machine.

May 10 '06 #3
<NA******@gmail .com> wrote
Will my solution cause any problems with a slow bloat over time? Am I
properly only "linking" to images, or will Access use the saved
"embedded" setting to absorb the image data over time? If that happens
it's definitely a problem, as my image archive for this project is
about 40MB at this point. I ran through one of the reports in
print-preview that accesses most of the images, and I didn't notice any
bloat in the db FE. It looks like a working solution.

Even though I answered the question myself, I welcome any and all
input/comments/corrections.


The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zi p is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
May 10 '06 #4
Jamey and Larry: Thanks for the replies. I found both helpful.

I am using image objects to manage the pictures, not OLE objects. Nor
do I allow form-view design changes.
I am using dynamic path detection to display pictures. The problem was
with the "default" image that has to be saved with the image object.
All seems well now, with the solution I outlined above.

I have noticed a lot of memory use during printing (~300MB) of my
larger reports, but the system I'm working with has enough memory to
handle it. If it becomes a problem, I may use Lebans' solution.

A new problem (already solved): When my database is deployed using the
Access 2003 runtime, none of the jpg images would display. Only bmp
images worked. The reason is that the runtime doesn't include any
Office graphics filters. Thanks, MS! I considered converting images
to bmp in realtime, but decided to use code that can display jpg files
w/o using Office graphics filters.

Solution:
http://www.lebans.com/loadjpeggif.htm
http://www.lebans.com/DownloadFiles/...r33GDiPlus.zip

I reviewed the code, installed the class module and 2 other required
modules, and updated my own image-redraw code to use the new method in
about an hour. Sweet.

I tested it, and images are drawn properly in the reports/forms using
the 2003 runtime and 2003 full install w/o any problems. I haven't
checked to see how memory useage has changed. (possibly lower now that
the Office graphics filters aren't used)

Therefore, a big thanks goes out to Stephen Lebans as well. :)

May 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2947
by: Roger Withnell | last post by:
I'm updating a record by opening a recordset, setting the fields and the updating it with objRS.Update. I need to set an image datatype to NULL. objRS("field") = NULL works for datatypes int and varchar but not for datatype image, although there is no error - the image field still contains the image! I'm using SQL server and running an UPDATE statement including image = NULL works.
4
2059
by: David Kyle | last post by:
Hello there, I'm having some problems setting the TextBox.Text Property in my code and having it returned to the client in the source when the TextBox.TextMode="Password". I know this is generally not a good idea to fill it with the actual password but I would like to put '*'s in it as place holders just so it looks like the password is actually typed out in there. Thanks,
4
4460
by: MLH | last post by:
Setting form's Picture property to another file from within VBA doesn't repaint the form with new bitmap - for instance... Me.Picture = "c:\pics\MyNewPic.jpg" I tried Me.Repaint afterward, to no avail. Ideas? Suggestions?
2
1698
by: Aussie Rules | last post by:
Hi, I have a situation where I set the image1.imageurl value in the codebehind, but the image doesn't update to be the new image, its just stays as it was. Is there some event i must fire to make the image control display the proper image... Thanks
0
1063
by: --== Alain ==-- | last post by:
Hi, I'm creating my own .NET control and i would like to allow user to allocate an image as property. for that i used the following code : #pragma region public Property : ImageSortAscendant // Allow user to select the image which will be displayed for column sorted ascendantly
3
1333
by: --== Alain ==-- | last post by:
Hi, I'm creating my own .NET control and i would like to allow user to allocate an image as property. for that i used the following code : #pragma region public Property : ImageSortAscendant // Allow user to select the image which will be displayed for column sorted ascendantly
1
2701
by: ApexData | last post by:
I have an ImageBox with PictureType set to LINK. I have a string with a path strPicFolderPath = "C:\Pictures" In the OnCurrent event of the form I have this code: If Len(Nz(Me.txtPHOTOFILENAME.Value, "")) <0 Then 'File name exists If Len(Dir$(strPicFolderPath + Me!)) <0 Then 'File found Me!.Picture = strPicFolderPath +
0
1211
by: Stan SR | last post by:
Hi, I use a repeater that calls a page where I display an image (sorry for my english ;) ) This page performs a webRequest to capture a jpg file And with the result I resize the picture and make OutputStream I have 2 questions :
0
1782
by: Zainull | last post by:
Hi, I'm very new to VB and I am using visual basic 2010 express. I have to write a program that is capable of simple image processing: The user must be able to type in the path and name of an image file or browse for the file (jpg and bmp). When a filename has been entered the image must appear in a Picture Box on the form. The colour of each pixel in the image should then be inspected and stored in one or more arrays. Once the array(s)...
0
8861
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, 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...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9236
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 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...
1
9154
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,...
0
9088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8051
agi2029
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...
0
5995
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();...
0
4502
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...
3
2147
bsmnconsultancy
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.