Here is a Demo that I actually created for another User illustrating many aspects of working with BLOBs. The original Code is by Alan Warren to which I made some modifications. In the Demo you can write Images to an OLE Object Field, display a BLOB Image, retrieve Images to a Temporary Folder, display File Properties of a stored Image, Edit a BLOB Image, etc. Hopefully, you will find it somewhat useful.
How to change an image on a form programatically
Collapse
X
-
Well surprisingly, it turns out that all I had to do was put each of the .png images on a form somewhere (this was the clue I got from ADezii's suggestion -thanks so much!), and then set the picture property of the logo image to the name of the desired image:
Code:Me![ImgLogo].Picture = conDept Me.Refresh
Thanks again.Comment
-
Nice work Petrol. I love your thinking. However ...
While this all works very nicely, there are times when a database gets corrupted beyond repair, that you may want to recreate the database from scratch and import across the various objects from the original that are still uncorrupted. While you can also do this with an older, saved, version if you have one, it's more common to start from scratch. If you were to do this without the original Form that has the Image controls on then you would be likely to come unstuck.
I suggest you would be better served by keeping that Form around but with a name or comment value to indicate why.Comment
-
Good point, though I shudder at the thought; however, I suspect that it was the act of placing the images on the form, rather than the existence of the form itself, that caused Access to hide copies down in its vault somewhere. I still have the original .png's from which I created the form, and they are in a file outside the DB which could get corrupted, so that's the safer option, n'est-ce pas?Comment
-
Incidentally, I received an email notification of NeoPa's last post - the first one I have received for this string - even though it's addressed to an email address I don't have! In fact, it's at least a year since I had received a system-generated email from Bytes. I know this isn't a forum about emails, but there's obviously just as much I don't understand about emails as about Access LOL.Comment
-
Interesting. I suspect the owner's been tweaking things again. I too have started receiving emails recently. I suppose we can also revisit our settings any time so go there if you're unhappy with how things are now.
As for the images being stored, I expect that would also happen automatically when you import the form so there is sense in keeping it. Obviously you can work with just the files in the background if you're confident that when the time comes that you need to do this you will remember all the details of this situation and not end up scratching your head wondering why these images, that used to work fine, suddenly aren't working in your new imported database.Comment
Comment