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

Set Image Control to Null

675 512MB
When Access saves a form with a linked image control, It saves the last-used image name in the Picture property.

When I sync my 2 computers, if I have changed code, starting the program on the other computer causes message
Expand|Select|Wrap|Line Numbers
  1. "Microsoft Access can't open the file 'D:\Old image name.jpg'.
This occurs before the Form.Open event.

Can I trap this, or cancel this or change some property of the image control when I save the form so this doesn't happen. I tried to change the visible property, but that didn't work. Error occurs even if control not visible.

This message will occur every time I use the program until I save the form again. That will cause the sync routines to copy the now most recent version to the other machine, and the problem occurs again.

Can I put a stop to this annoyance?
May 9 '09 #1
5 5301
FishVal
2,653 Expert 2GB
@OldBirdman
Hello, OldBirdman.

I couldn't reproduce that. In my case it didn't use last linked picture file and didn't ask to save form on closing after Picture property if Image control was modified via code.

Regards,
Fish
May 10 '09 #2
OldBirdman
675 512MB
Thanks Fish. So if you open the form in design view, what are the property values for imgCtl.Picture and imgCtl.PictureType?

As soon as I create an Image Control, Access asks for an Image name. If I don't enter a name in the dialog, the control is removed.

Now there is a name in imgCtl.Picture. It is C:\Pictures\TestImage.jpg and this name persists when I change Picture type from Embedded to Linked. When I move my Access project to my laptop (Vista), data is on the D:\ drive, so the picture name is invalid. Each time I use the program on the laptop, I am told that Access can't open this file. This message happens before the Form Open Event, so I can't trap it.

To stop the messages, I must open the form in design view. My code knows where the pictures are, so when I switch to design view, ingCtl.Picture is valid. If I save the form, the picture name will be invalid on the desktop. If I don't save the form from design view, the picture name will continue to be invalid on the laptop.

I have 14 projects that use images, and this has gotten more that just annoying.
May 10 '09 #3
FishVal
2,653 Expert 2GB
I've created Image control with some dummy picture (Access refuses to create one if no picture file was specified).

Then in Image control properties I've changed PictureType value to Linked and cleared Picture value (it turned to "(none)").

Additionally, if you want an Image control to display whatever default picture, then you may embed this picture into the Image control and, then, before the Image control is populated with a new picture, set PictureType to Linked.

Expand|Select|Wrap|Line Numbers
  1. With imgCtl
  2.     .PictureType = 1
  3.     .Picture = strPicPath
  4. End With
  5.  
May 10 '09 #4
OldBirdman
675 512MB
If I do that, I get a msgbox "Do you want to remove this picture from this form?" Stupid me, my brain intepreted that to mean 'Do I want to remove the control' because I don't consider a linked picture to be part of the form.

Thank you for setting me straight.
May 10 '09 #5
FishVal
2,653 Expert 2GB
You are welcome.

Best regards,
Fish
May 10 '09 #6

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

Similar topics

4
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what...
10
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...
2
by: strout | last post by:
It's a pain to create each button with 2 images: button_on.gif button_off.gif I am looking for a control that have on/off two states, preferred as BACKGROUND images and with button text on it. ...
1
by: Fahad Aijaz | last post by:
Hi, I am trying to display a Png image via ASP .NET. I get the image from the stream, creates the Bitmap, set the content type to Image/Png, but it give an error. If I set the content type to...
2
by: Jeronimo Bertran | last post by:
Hello, I am using a rendering aspx page to display a database image on an Image control. When the database record is retrieved, I am saving the bitmap to a session variable for the rendering...
3
by: jens.buchta | last post by:
Hi! I'm using a DataGrid with a template column to display an Image inside of it. I'm hooking into its OnPrerender-Event to set the ImageURL-Property dynamically. Everything works just fine...
4
by: jens Jensen | last post by:
Hello, I have an image file name in a table that a let users modify via a GridView/DetailView pair. * The actual image file is saved in the image folder of the application. But the image is...
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
2
by: | last post by:
I have a few custom controls that expose properties of type Image. The built in controls that have Image properties allow you to delete the image and set it back to "None". How can I allow my own...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.