[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I use a Picture stored in a database on an unbound object in a form

Posted on 2011-04-22
Medium Priority
Last Modified: 2012-05-11
I have a created a form that has room for a relatively small jpeg picture ont the form header.
I have therefore created a local parameters table with a single record and one of the fields is an OLE field where I have saved the JPEG.
I have inserted an unbound image object on my form and I would like the object image source to be =DLookUp("MainPageImage","tblLocalParams").
Is there any way of doing that?
I don't know where/how to load the code.
Question by:Rob4077
  • 2
  • 2

Author Comment

ID: 35448036
BTW, I am developing this in MS Access 2007, in case that makes any difference.
LVL 39

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 800 total points
ID: 35448042
If you have more than a few of these it's a bad idea. If you store a few images in access for background or tab purposes that's fine, ideally they should be .bmp so access doesn't waste a bunch of memory converting them.
If this is a picture tied to a record don't do it this way. Store the filename in the db and just have a folder with the files.
LVL 44

Accepted Solution

GRayL earned 1200 total points
ID: 35450281
I think it's a bad idea to store images in tables directly.  If you have the jpg named FormPic.jpg in the folder in which your mdb resides, insert this code in the Load event of the form on which you placed an unbound Image control named imgPic

Private Sub Form_Load()
  Me!imgPic.Picture = .\FormPic.jpg
End Sub

Author Comment

ID: 35451134
Thanks for your comments. My intention was to store only one small picutre in the database but given your comments I won't even store that. I will do it as GRayL suggested and get the users to save their preferred picture in the same folder as the application with a common name. Thanks.
LVL 44

Expert Comment

ID: 35451303
Thanks, glad to help.

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question