Home
dbPix
Download
Order
Testimonials
Support
Tutorials
Samples
KnowledgeBase
Links
Revision History
Documentation
Search
Contact
Site Map

Graph: dbPix image storage vs OLE Embedding and Linking in Microsoft Access


DBPix Sample Source Code: GetImageFolder
Back to sample
Option Compare Database
Option Explicit

' Get the path to where images are stored
' (the 'Images' subdirectory of the database location).

Public Function GetImgFolder() As String
    GetImgFolder = GetDBPath & "Images\"
End Function

'-----------------------------------------------
' Functions to get the path to the database file
'-----------------------------------------------

' Standard version for Access 2000 and later

Public Function GetDBPath() As String
    GetDBPath = CurrentProject.Path & "\"
End Function


' This version supports Access 97

Public Function GetDBPathA97() As String
    Dim strFullPath As String
    Dim I As Integer

    strFullPath = CurrentDb().Name

    For I = Len(strFullPath) To 1 Step -1
        If Mid(strFullPath, I, 1) = "\" Then
            GetDBPathA97 = Left(strFullPath, I)
            Exit For
        End If
    Next
End Function


' Gets the Back-End path in a split database (Access 2000 and later)
' Replace 'tblLinked' with a valid table name

Public Function GetDBPathBEA2k() As String
    Dim strFullPath As String
    strFullPath = Mid(DBEngine.Workspaces(0).Databases(0).TableDefs("tblLinked").Connect, 11)
    GetDBPathBEA2k = Left(strFullPath, InStrRev(strFullPath, "\"))
End Function


Back to sample