Image control in MS Access

celestialcitizen

New member
Local time
Today, 13:11
Joined
May 5, 2009
Messages
6
Can you help me out with the following problem:

I have an MS Access 2003 DB and an MS Access form as its front end.
I have managed to write code to capture image from a webcam to an image control in the access form.

Now can you tell me how can I store this image from the image control to the OLE Object feild of the database.

I want to store the images and not file paths etc....
 
Now can you tell me how can I store this image from the image control to the OLE Object feild of the database.

I want to store the images and not file paths etc....

Here come the hailstorm of objections.

If you are pressed about doing it this way, it is advisable to upgrade to A2007 and use an attachment field.
 
Okay like I know this method works.
I myself would do it. But the person for whom I'm designing this stuff is a naive user. So if the file paths change then I'm not sure he can work around that problem : (

That's why I asked for this particular solution...

Can you please help me out !!!
 
Initially you need to be looking at File to blob and Blob to File. I have a working example on my other laptop and will publish it later.

David
 
why not design your db a little differently: make the image save to a subfolder of where the db resides, then you can save just the image name, and your code can refer to it by using something like

Code:
imgControl.Picture = CurrentProjectPath & subforldername & Me.ImageName

there's lots of threads in this forum that go into relative linking of images. here's a couple of threads that helped me:

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

http://www.access-programmers.co.uk/forums/showthread.php?t=157925&highlight=relative+path

there is another that i really found useful, but i can't find it at the moment. in any case, a strategic use of keywords in the search ought to get you some progerss :)
 
(oh and the "sample databases" section of this forum i've also foudn very helpful) :)
 
Here is the demo I was talking about.

You will need to run the Link tables Manager before testing the demo. Open the Embedded Objects Mdb as the Front end.
Also place the word cod in the current project path

David
 

Attachments

Hehehe, I feel like a dork for thinking this is funny. Thanks for the rep. I'm at 47 now. Isn't 50 the next step?

wow! how on earth did i get 144 points??? i only pop in every now and then...!

i don't know when the jelly babies change... i don't think i noticed mine straight away...
 
Last edited:
Hey People

Thanks a lot I'm overwhelmed by your response.

The scenario is like this.
The webcam has captured the image and has stored the image to a file on the harddisk.

Now I assign the image control the picture using the following piece of code:
Me.Image1.Picture = filepath

Now I want to store this image in an OLE Object field in the Access DB
 
Have you not looked at the demo I posted in #7 this does what you want.

David
 
Hey
I downloaded the stuff but when I try to open it it says

Microsoft Access cannot open this file
 
What version of Access are you using and at what point is the error occurring?

have you read the moreinfo doc?
 
I have ms access 2003
It says opening the file has potential security problems
This error occurs whenever I open both the mdbs
 
This is to do with the code and macro security settings you may need to reduce your security settings to low. otherwise select open. There is no malicious code in the sample.

David
 

Users who are viewing this thread

Back
Top Bottom