+ Post New Thread
Results 1 to 6 of 6
Office Software Thread, Show image in a field? in Technical; Hi, I am hoping someone can point me in the right direction. My database has a 'Photo' Column and in ...
  1. #1
    S_Hannah's Avatar
    Join Date
    Oct 2009
    Location
    Manchester
    Posts
    65
    Thank Post
    16
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Show image in a field?

    Hi,
    I am hoping someone can point me in the right direction. My database has a 'Photo' Column and in that column it would have text i.e. DSC-0001. That photos would be stored within a directory i.e. C:\Images and at present staff have to browse to the images directory to see the photo.

    Is there a way of having they DB store the DSC-0001.jpg and there be code in the BG that would know what to do with the image i.e. show the images in a container but put the prefix of C:\Images\[db value]

    If anyone could help, I would be ever so greatful

  2. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,807
    Thank Post
    3,320
    Thanked 1,056 Times in 977 Posts
    Rep Power
    365
    If MS Access then you could create a form and use some vba code to populate the image or picture object from the relevant text field that contains the image name ie

    if the picture box was called imgPicture, the text field that contained the name of the image was txtImage then you could have something like

    You would probably have some code like below in both the previous and next buttons underneath the relevant code to make the form go between the records

    Obviously syntax may be slightly different on how you load the image into the picturebox etc but you get the jist

    Code:
    Dim strPath As String
    
    strPath = "C:\Images\" & txtImage.Value & ".jpg"
    
    imgPicture.LoadPicture(strPath)
    Last edited by mac_shinobi; 22nd March 2012 at 08:32 PM.

  3. #3
    S_Hannah's Avatar
    Join Date
    Oct 2009
    Location
    Manchester
    Posts
    65
    Thank Post
    16
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Hi Sorry,

    Too busy tyring to write this up, makes sence in my head. I am just using an Acess 2010 database. And the images are just within a directory and I would like the DB to read from there.

  4. #4

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,807
    Thank Post
    3,320
    Thanked 1,056 Times in 977 Posts
    Rep Power
    365
    Just edited my above post

    Hopefully the above is what you were after ?

    Might be able to insert said code into the form load event or a different event instead of having it twice ( once for previous and once for next button ) ??

    That or maybe make your own sub and have that code in said sub so you are calling it when required
    Last edited by mac_shinobi; 22nd March 2012 at 08:38 PM.

  5. Thanks to mac_shinobi from:

    S_Hannah (22nd March 2012)

  6. #5
    S_Hannah's Avatar
    Join Date
    Oct 2009
    Location
    Manchester
    Posts
    65
    Thank Post
    16
    Thanked 1 Time in 1 Post
    Rep Power
    0
    mac_shinobi,

    Thank you for your help, really appreciate it. Given a huge Access Database, but not done this sort of thing for years!

    Code used was:

    Dim strPath As String

    strPath = "C:\Images\" & txtImage.Value & ".jpg"
    imgPicture.Picture = strPath

    Once again, Thank you.

  7. Thanks to S_Hannah from:

    mac_shinobi (22nd March 2012)

  8. #6
    S_Hannah's Avatar
    Join Date
    Oct 2009
    Location
    Manchester
    Posts
    65
    Thank Post
    16
    Thanked 1 Time in 1 Post
    Rep Power
    0
    I have implemented the code and it works great however when I click next it still shows the old image, even when the code has been applied to the next button. Any Ideas?

    Stu

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 31st August 2010, 01:18 PM
  2. Replies: 1
    Last Post: 14th May 2008, 03:30 PM
  3. [CLOSED] Improvement: Limited to 4 images in msg
    By SimpleSi in forum EduGeek.net Site Problems
    Replies: 4
    Last Post: 31st January 2008, 07:45 PM
  4. Replies: 4
    Last Post: 17th December 2007, 05:15 PM
  5. Images in Office 2003 documents
    By mattpant in forum Windows
    Replies: 6
    Last Post: 7th October 2005, 06:12 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •