Results 1 to 13 of 13
  1. #1
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115

    Requery Solved

    Hello everyone, I put in a mask (by copying from the internet) a code that allows you to search within the pc to upload a photo in a record. Within the table for each record corresponds to a picture. This all works
    My problem is that if I replace the photo, you see the new uploaded photo if I leave the form open. I searched the internet and found the function Me.Requery and Me.refresh but both do not work in my case.
    We carry the code


    On Error GoTo cmdAddSmall_Err
    Dim strFilter As String
    As Long Dim lngflags
    As Variant Dim varFileName


    strFilter = "All Files (*. *)" & vbNullChar & "*. *" _
    & VbNullChar & "All Files (*. *)" & VbNullChar & "*. *"

    lngflags = tscFNPathMustExist Or tscFNFileMustExist _
    or tscFNHideReadOnly

    varFileName tsGetFileFromUser = (_
    fOpenFile: = True, _
    strFilter: = strFilter, _


    rlngflags: = lngflags, _
    strDialogTitle: = "Please choose a file ...")

    If IsNull (varFileName) Then
    else
    Me! [Percorso_foto_front2] = varFileName
    end If


    cmdAddSmall_End:
    On Error GoTo 0
    Exit Sub


    cmdAddSmall_Err:
    Beep
    MsgBox Err.Description,, "Error:" & Err.Number _
    & "In file"
    Resume cmdAddSmall_End
    Me.Requery
    Last edited by sergran; 08-30-2013 at 07:09 AM.

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Me.[YourImagecontrolName].Picture = "PathToThePicture". In your case,use the path stored in the table.

  3. #3
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    I'm sorry but I did not understand

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Within the table for each record corresponds to a picture.
    What does the table store ?How do you show the picture on form ?

  5. #5
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    Sorry but they are not very practical Vba. I attach the database
    thank you

    Requery.zip

  6. #6
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    You have a text box which stores the path to picture.
    Me.[YourImagecontrolName].Picture = "PathToThePicture"
    Use this line after the file is selected.
    Code:
    Me.Cover_front.Picture = Me.Percorso_foto_front

  7. #7
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    I entered to Event "after update" control "Percorso_foto_front" the code
    Me.Cover_front.Picture = Me.Percorso_foto_fron
    but does nothing ...
    What could be wrong?

  8. #8
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    If IsNull (varFileName) Then
    else
    Me! [Percorso_foto_front2] = varFileName
    Me.Cover_front.Picture = Me.Percorso_foto_front

    end If
    When user browses and selects the picture, the path to picture is saved in the text box. The picture needs to be changed as per the changed file path.

  9. #9
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    Is perfect...fine thanks much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  10. #10
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Glad to help.
    Mark the thread as solved.

  11. #11
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    I changed the title to read solved ... is right or should I do it another way?
    thanks

  12. #12
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616

  13. #13
    sergran is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    115
    Thanks much

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

Similar Threads

  1. Requery not working (again)
    By togo in forum Access
    Replies: 4
    Last Post: 10-16-2012, 10:23 AM
  2. OpenQuery and Requery
    By Daryl2106 in forum Access
    Replies: 8
    Last Post: 11-24-2011, 08:40 AM
  3. Requery
    By Grizz2 in forum Queries
    Replies: 2
    Last Post: 05-31-2011, 10:23 AM
  4. Replies: 1
    Last Post: 03-13-2011, 02:29 PM
  5. Requery?
    By CO711 in forum Forms
    Replies: 0
    Last Post: 08-06-2008, 08:03 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
  •  
Other Forums: Microsoft Office Forums