Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125

    Repeat use of a Call or ImgStock.Picture Problem


    I have a situation where I have multiple picture versions to display. A ComboBox causes retrieval of the base record with field JPEG_Id; it contains the value (CrNro58v1). This value is saved to JPEG_Hold. When the user presses the button for more views, my logic correctly finds the file (CrNro58v2) and displays it. When the user asks for more views, the logic correctly builds the path/file (C:\Users\Philip\Documents\Access Data Bases\Development\Gallery_Pics\CrNr058v3.jpg) and again Calls the executing the code "Me.ImgStock.Picture = Gal_Filename" but this results in the execution of "On Error GoTo Err_JPEG"_Display" where the not found message is displayed. The file does exist. This third view not found occurs for all carvings with multiple views. Is there a limiting factor in calling a procedure or ImgStock.Picture reuse? TIA Phil

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Show the code involved. I don't think you are reaching any access/vba limit. It may be in your code/loop/logic.

  3. #3
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125
    Here Is the entire code for the Form:
    Option Compare Database
    Option Explicit
    Dim JPEG_Hold As String

    Private Sub Form_Current()
    Dim Gallery As Form
    Dim Select_Nr As Control
    Dim pathname As String
    Dim Filename As String
    Dim Sr_Message As String ' Question if this line should exist, it is a Form Tag
    ' Set Gallery = Screen.ActiveForm
    ' Gallery.Select_Nr = Gallery.ControlSource
    Sr_Message = "Form_Current start of Procedure"
    On Error GoTo Err_cmdClose_Click
    Sr_Message = "opened Form"
    'set the path to directory holding database
    pathname = CurrentProject.Path
    Debug.Print "pathname"
    Exit_cmdClose_Click:
    Exit Sub
    Err_cmdClose_Click:
    If Err.Number = 2220 Then 'can't find the file
    Resume Next
    ElseIf Err.Number = 94 Then 'invalid use of null
    Me.ImgStock.Picture = ""
    Resume Next
    Else
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
    End If
    End Sub
    ' __________likely insert button_on_click______________
    Private Sub cmdClose_Click()
    On Error GoTo Err_cmdClose_Click
    DoCmd.Close
    Exit_cmdClose_Click:
    Exit Sub
    Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
    End Sub
    Private Sub JPEG_Display()
    ' Procedure executed through Calls Select_CrNr_AfterUpdate
    On Error GoTo Err_JPEG_Display
    Dim Gal_Filename As String
    Dim pathname As String
    Dim BldFileNm As String
    ' Fetch the relative bath for DBM
    pathname = CurrentProject.Path
    ' Pictures will be in folder Gallery_Pics"
    ' to construct file name
    ' file name format is CrNr058v1.jpg for Yoda
    ' Determine Select_Nr range: units, tens or hundreds
    BldFileNm = "Gallery_Pics\" & JPEG_Hold & ".jpg"
    ' BldFileNm = "Gallery_Pics\" & JPEG_Id & ".jpg"
    ' Build full file path
    Gal_Filename = pathname & "\" & BldFileNm
    File_Path = Gal_Filename
    Me.ImgStock.Picture = Gal_Filename
    On Error GoTo Err_JPEG_Display

    If Dir(Gal_Filename) = "" Then
    ' Display the "no picture exist for this carving" message picture
    BldFileNm = "Gallery_Pics\" & "CrNr963v1" & ".jpg"
    Gal_Filename = pathname & "\" & BldFileNm
    Me.ImgStock.Picture = Gal_Filename
    End If

    GoTo Exit_JPEG_Display

    Err_JPEG_Display:
    BldFileNm = "Gallery_Pics\" & "CrNr963v1" & ".jpg"
    Gal_Filename = pathname & "\" & BldFileNm
    Me.ImgStock.Picture = Gal_Filename
    Sr_Message = "Picture not on File"
    Clear_Screen
    ' Resume Exit_JPEG_Display
    Exit_JPEG_Display:
    End Sub
    Private Sub SeeMore_Click() ' <=========== view more button entry
    Dim More_file As String
    Dim Current_Ver As String
    Dim Ver As String
    ' Current_Ver = Mid(JPEG_Id, 9, 1)

    Current_Ver = Mid(JPEG_Hold, 9, 1)
    If Current_Ver = "1" Then
    Ver = "2"
    GoTo Done_Iffing
    End If
    If Current_Ver = "2" Then
    Ver = "3"
    GoTo Done_Iffing
    End If
    If Current_Ver = "3" Then
    Ver = "4"
    GoTo Done_Iffing
    End If
    If Current_Ver = "4" Then
    Ver = "5"
    GoTo Done_Iffing
    End If
    If Current_Ver = "5" Then
    Ver = "6"
    GoTo Done_Iffing
    Else
    Sr_Message = "No more views of this carving" & Ver
    End If
    Done_Iffing:
    JPEG_Hold = Left(JPEG_Id, Len(JPEG_Id) - 1) & Ver
    Call JPEG_Display
    End Sub
    Private Sub Select_CrNr_AfterUpdate() ' <=========== first view combobox entry
    Dim Ver As Integer ' <== changed from string
    Dim CalVer As Integer
    ' Dim JPEG_Hold As String
    CalVer = 1
    ' JPEG_Hold = JPEG_Id ' save For manipulation
    Me.Requery
    JPEG_Hold = JPEG_Id

    Sr_Message = "**" & JPEG_Hold & "**"

    Call JPEG_Display
    End Sub
    Private Sub Title_Click()
    Set CarvingNR = Forms!Gallery.Select_Nr
    Set Stock_Id = "21"
    End Sub
    Private Sub Clear_Filter_Click()
    On Error GoTo Err_Clear_Filter_Click
    Me.Select_CrNr.Value = ""
    Me.Requery
    ' Call Clear_Screen
    Exit_Clear_Filter_Click:
    Exit Sub
    Err_Clear_Filter_Click:
    MsgBox Err.Description
    Resume Exit_Clear_Filter_Click

    End Sub
    Private Sub Clear_Screen()
    Me.Requery
    Me.Select_CrNr.Value = ""
    ' Title = "" Runtime error '-214735267(80020009)' also not updateable
    ' Me.Wood_Id.Value = "" Run Error 3326 Recordset is not updateable
    ' Me.Source_Id.Value = "" Run Error 3326 Recordset is not updateable
    ' Me.Dt_Fin.Value = "" Run Error 3326 Recordset is not updateable
    End Sub

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    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. #5
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125

    Past Threads

    They are all part of the same project, the latter two were solved. I tried to upload my db but a MS update locked up my keyboard half way through the process or I was doing it wrong? Phil

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Don't know - try again?
    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.

  7. #7
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125

    Repeat use of a Call or ImgStock.Picture Problem

    Am I using the correct procedure for uploading a db: click on "Go Advanced", click on Manage Attachments, click on add files, browse my PC folders and click on the zip file to upload and then click on the upload button? My WS_DBMS.ZIP file is 713 KB and should not take for ever to upload. TIA Phil

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That sounds right. The file never shows up in the Attachment frame at the bottom of the Manager?

    An alternative is to upload to a fileshare site such as Box.com and post link to file.
    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.

  9. #9
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125
    I am getting help on the upload problem (probable security?), in the mean time I would like to explicitly describe my last two problems: (1) The “moreViews?” button on Form Gallery will only work once; the ComboBox selection ofcarving 58 will return/display the file name CrNr058v1. The first time the userpresses the ”more Views” button the file CrNr058v2 is returned/displayed. Onthe second pressing of the ”more Views” button, the correct file name CrNr058v3is developed as well as the string containing the complete path for fetchingthe next picture, however the instruction “Me.ImgStock.Picture = Gal_Filename” invokesthe code
    “On ErrorGoTo Err_JPEG_Display” and no picture is displayed. For this code to be tested, Gallery_Pics mustcontain CrNr058v1, CrNr058v2, CrNr058v3, CrNr058v4; any old pictures will do.
    (2) Beginner_PicturesForm has a navigation problem. It will not access folder Beginner_Pics. Itreturns results from Gallery_Pics folder.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I still think should use ControlSource property instead of Picture.
    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.

  11. #11
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125

    Repeat use of a Call or ImgStock.Picture Problem

    Quote Originally Posted by June7 View Post
    I still think should use ControlSource property instead of Picture.
    Assuming your response is for problem (1), are you saying in form ComboBox “Select_Nr” I should select a Table field in Pocedure Event For ControlSource on the property sheet? I do not think it would work since only the base entry “CrNr058v1” is there. All other filed names CrNr058v2, CrNr058v3, CrNr058v4), etc. are produced through string manipulation of the base value. I also do not know what to replace “Me.ImgStock.Picture” with. Perhaps you can provide topics to research in one of my references:
    1. Access 2002 Desktop Developer’s Handbook by Paul Litwin, Ken Getz, Mike Gundrloy
    2. Microsoft Office Access 2003 by Virginia Anderson
    3. Access 2003 VBA by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein
    4. Access Programming for Dummies (1954) byRob Krumm
    5. Access Cookbook by Ken Getz, Paul Litwin, Andy Baron
    6. Pro VB 2008 and the .Net 3.5 Platform by Andrew Troelsen TIA Phil

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The ControlSource property was added to the Image control with Access 2007.

    http://bytes.com/topic/access/answer...-access-2007-a

    Replace Me.ImgStock.Picture with Me.ImgStock.ControlSource

    Or call function that constructs the image file path directly from the ControlSource property, just like a function can be called from ControlSource of any data control. That's what I do.
    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.

  13. #13
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125
    I investigated "http://bytes.com/topic/access/answer...-access-2007-a" and found that it did not apply in my situation, there was no Referenced "MDIWCTL.DLL". I have been watching VBA tutorials to see if I can obtain understanding on how to change {Gal_Filename = pathname & "\" & BldFileNm
    File_Path = Gal_Filename
    Me!ImgStock.Picture = Gal_Filename '<== Picture
    On Error GoTo Err_JPEG_Display} to a Me.imgstock.{control statement}. So far no understanding. TIA Phil

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    And I don't understand what you are trying to do.

    If you want dynamic display of images with records then the ControlSource property of Image control is the simplest and easiest method I know. Setting the Picture property with code was the specified method before Access 2007 but I never had to use it.

    No idea what MDIWCTL.DLL is for.

    Sorry, not able to resolve your issue.
    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.

  15. #15
    justphilip2003 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2013
    Location
    Ohio
    Posts
    125
    Could you show me a one or two line sample of your code? TIA Phil

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

Similar Threads

  1. Me.Picture problem
    By RachelBedi in forum Access
    Replies: 1
    Last Post: 10-05-2012, 12:55 PM
  2. Replies: 30
    Last Post: 08-15-2012, 02:25 PM
  3. Picture insert problem
    By allstar45 in forum Reports
    Replies: 3
    Last Post: 04-20-2012, 01:17 PM
  4. Linked Picture Problem
    By stepwaec in forum Reports
    Replies: 2
    Last Post: 07-14-2011, 08:38 PM
  5. Problem with Trying to Repeat Records in VBA
    By P5C768 in forum Programming
    Replies: 9
    Last Post: 09-22-2010, 12:09 PM

Tags for this Thread

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