Solved

Automatically insert pictures into a form according to record ID

Posted on 2011-09-19
2
329 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
[X]
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
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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