Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Automatically insert pictures into a form according to record ID

Posted on 2011-09-19
2
Medium Priority
?
346 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 500 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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.
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 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…

597 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