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

Posted on 2011-04-22
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

    Author Comment

    BTW, I am developing this in MS Access 2007, in case that makes any difference.
    LVL 38

    Assisted Solution

    by:Aaron Tomosky
    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

    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

    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

    Thanks, glad to help.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now