Solved

Automatically insert pictures into a form according to record ID

Posted on 2011-09-19
2
289 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

760 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

22 Experts available now in Live!

Get 1:1 Help Now