Results 1 to 5 of 5

Change Image On Form

  1. #1
    DMT Dave is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    300

    Change Image On Form

    Hi Guy's, is there a method of changing an image on a form ?



    I currently added an image from the pane options but when i change a combo to something else, can i change the image ? i current have picture1.jpg, if i have picture2 in C:Folder/Folder2/Picture2.jpg can i change this in VBA ?

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,423
    If we're talking about an image control and the PictureType property is Linked, you assign the path to the Picture property using some event. In your case, probably the combo AfterUpdate.
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.

  3. #3
    DMT Dave is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    300
    Thank you, all working, my next one is how can i change the image via looping through folder until last image then return to first image ?

    So if i have pic1, pic2 and pic 3 in DB Images, i am wanting to add a left command button to go to first image in the folder then Right arrow button to add pic2 image and click right again for pic3, then if we click right again whilst on pic3, it returns to pic 1 as there isn't a pic4 ??

    Code:
    If Left(Me.txtBrand, 3) = "ABC" Then
    If Left(Me.txtModel, 3) = "DEF" Then
    Me.imgMain.Picture = "T:\Images\DB Images\Brand\Pic1.jpg"
    End If

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    6,423
    I don't understand the question. The usual approach is to associate paths with records, not loop through a folder full of files.
    As you navigate through records, you alter the picture property of the control, usually by using the forms Current event. I suppose if you get to the last (or first) record you could code to MoveFirst (or MoveLast as the case may be) but why bother when there are built in navigation controls for this?

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    8,477
    Here is some code that changes the text in a text box by clicking either button. I don't have your dB and I'm not clear what object you want to cycle.
    The max value is 3 in this case. A better way might be to have a table with the path\pic name, open a query and select the path\pic name in sequence.
    Attached Files Attached Files
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-27-2019, 08:56 PM
  2. Image saved on a table wont change in form
    By jfaria123 in forum Forms
    Replies: 2
    Last Post: 05-22-2018, 12:07 PM
  3. Change an image on a form based on a combobox
    By jessehiggins in forum Database Design
    Replies: 3
    Last Post: 02-21-2014, 04:31 PM
  4. Having Combo box change an image
    By ashandy8 in forum Forms
    Replies: 3
    Last Post: 12-02-2012, 03:21 PM
  5. Change image directory
    By amer in forum Access
    Replies: 3
    Last Post: 06-09-2010, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums