Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Automatically insert pictures into a form according to record ID

Posted on 2011-09-19
2
321 Views
Last Modified: 2012-05-12
Hello,
I’m using Access 2007 and I’m trying to insert a picture into a form according to the ID number of the form record,  I have tried the below with a text box as well as an OLE Object, with the text box I get literally text in the box as in: C:\Users\mlaroda\Desktop\MuscleTuneFitness\Pics\9.bmp

With the OLE Object box I get nothing but a blank box, I’m not a programmer so please keep it as simple as possible, the code I have is below

 Private Sub Command120_Click()
       Dim XFLName As Integer
    Dim strPic As String
    XFLName = ID
   
    strPic = ("C:\Users\mlaroda\Desktop\MuscleTuneFitness\Pics\" & XFLName & ".bmp")
    Me.tbl_Con_Photo = strPic


End Sub


Thanks in advance
0
Comment
Question by:mjlaroda
2 Comments
 
LVL 26

Accepted Solution

by:
Nick67 earned 125 total points
ID: 36564066
Here is a sample.
Export Form1 to your db
Make the record source something that has ID in it.

Then play with it

Your control needs to be an image control
You need a control with ID as a control source to be on the form
It can be hiddden, but must exist
Your code needs to be

 Private Sub Command120_Click()
    Dim strPic As String
   
    strPic = ("C:\Users\mlaroda\Desktop\MuscleTuneFitness\Pics\" & Me.ID & ".bmp")
    Me.tbl_Con_Photo.Picture = strPic


End Sub

Picture.mdb
0
 

Author Closing Comment

by:mjlaroda
ID: 36567506
Thanks, its working Yeah.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

807 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