Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,638

    @GinaWhipp, is that question for me? Yes, always. Never used OLEObject controls.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    ah yes, not directly, but you can indirectly which is what I was thinking about (my bad for not checking)

    have a textbox called say itext1 - this can be hidden

    in image control have controlsource =[itext1]

    in code have

    itext1.ControlSource = "=""" & strpath & rs!PartNo & ".jpg"""

    what I don't understand is if this works

    Me!Image1.Picture = strpath & rs!PartNo & ".jpg"
    rs.movenext
    Me!Image2.Picture = strpath & rs!PartNo & ".jpg"
    rs.movenext

    why did the OP try

    Me.Picture("Image" & i) = strpath & Rs!PartNo & ".jpg"

    why not just use in the loop

    Me.Controls("Image" & I).Picture = strpath & rs!PartNo & ".jpg"

    or

    Me("Image" & I).Picture = strpath & rs!PartNo & ".jpg"

    Also not clear about the loop - first there have to be at lease 64 partnos >999999 - fair enough it works for the text, so I guess there are. But what if there is no image associated with that part? an error would be generated - unless error reporting has been turned off.

  3. #18
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    @June

    No, it was for the OP just to be sure because the
    Code:
    Me.Controls("Image" & i).Picture 
    Should have worked and I wondered if the OP was using correct control.

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,638
    Ajax, oops, I stand corrected. Can set textbox ControlSource on report with Open event but that will not allow dynamic loading of data. And cannot set ControlSource in Format event.

    Yes Gina, that is supposed to work with image control, I've just never had to use VBA to dynamically load images.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    Kobo77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    6
    Ok, thanks for all the assistance.
    Me.Controls("Image" & i).picture = strpath & rs!PartNo & ".jpg"
    is the solution. Knew it was there somewhere and thanks to the various suggestions we get to the answer.
    Not sure how I close off the thread and mark it as solved but solved it is.
    Many thanks to all of you for your input.

  6. #21
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    Not sure how I close off the thread
    at the top of the thread, 'click on thread tools', then select 'mark this thread as solved'

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,638
    Glad you have a solution. I am still inclined to think possible without VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Subscript out of range
    By wpryan in forum Forms
    Replies: 2
    Last Post: 11-19-2015, 11:18 AM
  2. Sometimes get subscript out of range
    By khughes46 in forum Import/Export Data
    Replies: 8
    Last Post: 06-13-2014, 10:22 AM
  3. subscript out of range
    By philfer in forum Access
    Replies: 3
    Last Post: 08-17-2013, 01:22 PM
  4. Wild Cards in Linked Image Names
    By Siiig in forum Forms
    Replies: 2
    Last Post: 01-11-2013, 01:01 PM
  5. Subscript out of range (9)
    By msche398 in forum Programming
    Replies: 1
    Last Post: 07-08-2011, 12:52 PM

Posting Permissions

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