A1VBCode Forums

How to access file in same path as ACCESS database


http://www.a1vbcode.com/vbforums/Topic27751.aspx

By victor64 - 6/2/2009

Hello,

I am trying to view PNG files listed in an ACCESS file, the PNG files are on the same path as the application. Including the following syntax: /intro.png in the
table is not working. Can you please help me with the proper syntax to view the PNG files in the same path as the ACCESS file.

Thanks,

Victor

By Mark - 6/3/2009

Now the App.Path is good enough for this and 90% of the time your app will be running from a folder. If it runs from the root of a drive then that will cause a problem. What I do is use a String variable Ap to find the app location. If you have multiple Forms that need this location then declare it as Public in a Module.

This is about the only  place I like using an IIf statement.

Dim AppPath As String

    AppPath = IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\")