none
currentproject.path in access 2013 RRS feed

  • Question

  • Hi all,

    I've a database with a form in access 2010, in the form shows a picture with relative path with this code:

    Private Sub Form_Current()
    Dim ruta As String
    ruta = CurrentProject.Path & "\fotos\"
    On Error GoTo ErrorFOTO
    Me.ImagenCliente.Picture = ruta & Me.RutaFoto
    Exit Sub
    ErrorFOTO:
    Me.ImagenCliente.Picture = ruta & "default.jpg"
    Resume Next
    End Sub

    it works fine, but when I run the database in Access 2013 the picture don't appear, the variable is ok.

    Is any difference between access 2010 and 2013?

    thank you for advance

    Tuesday, February 23, 2016 5:49 PM

Answers

  • hello, I finally find the error, the explorer path and the access path no affect this, the error was on the property data on the image box it was linked to the field rutafoto of the table. many thanks!
    • Marked as answer by David_JunFeng Thursday, March 3, 2016 6:56 AM
    Thursday, February 25, 2016 4:32 PM

All replies

  • assuming Access 2013 is on a different PC - then one would first guess that the path it needs differs

    you can sanity check by temporarily putting in a certain path to a local image on the PC itself...

    Tuesday, February 23, 2016 6:38 PM
  • Hi Joan. Sorry if this is kind of an obvious question but is the code running in the 2013 machine? I mean, have you enabled content or placed the file in a Trusted Location? Just curious...
    Tuesday, February 23, 2016 7:00 PM
  • thanks for your support, Yes I copy access file in pc, is rare because the string variable have the correct path, tomorrow I try to put local path for the photo regards
    Tuesday, February 23, 2016 7:50 PM
  • Hi, Joanrts

    Do you resolve your issue? I suggest that you could make sure that you have copied access file and picture file in pc.

    Wednesday, February 24, 2016 3:25 AM
  • hello again,

    I think I've find the error, but no solution yet

    The problem is in my work pc, it is Spanish Windows 7 with Access spanish 2013, the explorer show me the folders like:

    C:\Usuarios\xxx\escritorio\database\fotos

    and Access read the path like:

    C:\Users\xxx\desktop\database\fotos

    and don't load the image. Is a system problem?

    Wednesday, February 24, 2016 6:24 AM
  • Hi, Joanrts

    According to your descrition, I suggest that you could modify like below:

    On Error GoTo ErrorFOTO
    Me.ImagenCliente.Picture = "\fotos\" & Me.RutaFoto
    Exit Sub
    ErrorFOTO:
    Me.ImagenCliente.Picture = "\fotos\" & "default.jpg"
    Resume Next

    Thursday, February 25, 2016 8:41 AM
  • hello, I finally find the error, the explorer path and the access path no affect this, the error was on the property data on the image box it was linked to the field rutafoto of the table. many thanks!
    • Marked as answer by David_JunFeng Thursday, March 3, 2016 6:56 AM
    Thursday, February 25, 2016 4:32 PM
  • Hi, Joanrts

    congratulate, thanks for you sharing your solution.

    Thursday, March 3, 2016 6:56 AM