Results 1 to 8 of 8
  1. #1
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26

    path for the picture

    Hello

    I have an list box and I put the following code in AFTER UPDATE event
    In the list are some dates from one table. Everything goes fine, except the path for the picture.
    wen I have an error on the path of the picture, to go an error_handler. if the path is null then to insert an picture with "noImage.jpg". If it is an error (the picture was deleted or something else) then to insert again the path of NoImage.jpg
    so this is my partial working code


    Code:
    Private Sub List36_AfterUpdate()
    On Error GoTo PictureNotAvailable
       
       Dim rs As DAO.Recordset
       If Not IsNull(Me.List36) Then
            If Me.Dirty Then
                Me.Dirty = False
            End If
    
            Set rs = Me.RecordsetClone
            rs.FindFirst "[imagineID] = " & Me.List36
            If rs.NoMatch Then
                MsgBox "Not found: filtered?"
            Else
    
                Me.Bookmark = rs.Bookmark
            End If
            Set rs = Nothing
        End If
        Me.Image0.Picture = Me.List36.Column(3)
    
    PictureNotAvailable:
        Me.Image0.Picture = Application.CurrentProject.path & "\img\NoImage.jpg" 'The imagine is displayed
        If Me![poza] = Null Then Me![poza] = Application.CurrentProject.path & "\img\NoImage.jpg" ' Null = Null so True but thas not put the path in the table (stored)
        
    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How do you get out of this procedure without going through the error code?

  3. #3
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    What RuralGuy means is that you need to explicitly get out of the proc before the label position by including 'Exit Sub'.

  4. #4
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    correct.. thx for correction [exit sub]

    but the
    Code:
    If Me![poza] = Null Then Me![poza] = Application.CurrentProject.path & "\img\NoImage.jpg"
    it is not working

  5. #5
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    Place a breakpoint at that line and debug - check to see if the path is correct and valid, i.e. if there is a picture file with that name and extension at that position.

  6. #6
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    the path for picture is correct.
    if I puted like this is, It replace all the pictures with an noPicture.jpg

    Code:
    If Me![poza] = Null Then 
    'nothing
    else
    Me![poza] = Application.CurrentProject.path & "\img\NoImage.jpg"
    end if
    so I do not understand why the condition of true it is not working

    Code:
    If Me![poza] = Null Then Me![poza] = Application.CurrentProject.path & "\img\NoImage.jpg"

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    *Nothing* is ever equal to Null, including Null. Try using the IsNull() function.

  8. #8
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    great ..thx mate

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

Similar Threads

  1. DLookup on the right path?
    By GenericHbomb in forum Programming
    Replies: 2
    Last Post: 07-14-2011, 08:10 AM
  2. back end path
    By Mclaren in forum Programming
    Replies: 1
    Last Post: 06-08-2011, 01:13 PM
  3. not a valid path
    By JJJ in forum Access
    Replies: 0
    Last Post: 03-28-2011, 10:50 AM
  4. Find UNC path
    By jordanturner in forum Access
    Replies: 2
    Last Post: 09-17-2010, 09:18 AM
  5. Not a valid path
    By hhuuhn in forum Access
    Replies: 2
    Last Post: 08-23-2010, 02:06 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