Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1164
  • Last Modified:

App.Path in vba?

How would I ask access what my DB path is? like App.Path is vb?

   - Marc
0
MarcGraff
Asked:
MarcGraff
1 Solution
 
Benjamin_LukCommented:
Please try following code to find the db path:

Function FindMyFile()
Dim i As Integer
With Application.FileSearch
.NewSearch
    .LookIn = "C:\Scratch\Data"  'Search path
    .SearchSubFolders = True
    .FileName = "*.dbf" 'Here to set the file type or name
    .MatchTextExactly = True
    .FileType = msoFileTypeAllFiles
    If .Execute() > 0 Then
        MsgBox "There were " & .FoundFiles.Count & _
            " file(s) found."
        For i = 1 To .FoundFiles.Count
            MsgBox .FoundFiles(i)
        Next i
    Else
        MsgBox "There were no files found."
    End If
End With
End Function

Regards

Ben
0
 
peter57rCommented:
currentproject.path

Pete
0
 
stevbeCommented:
Pete's suggestion is great for v2000 and above.

for 97 you can ...

Left$(CurrentDB.Name, Len(CurrentDB.Name) - Len(Dir(CurrentDB.Name)))

Steve
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
SoggyPCommented:
Hi Folks,

Can't you use just use currentdb.name and extract the lefthand side of the string?

Later,

Jes
0
 
stevbeCommented:
Hi Jes,  that is what my post does ...
0
 
SoggyPCommented:
Hi Folks,

@Steve:  Oh, alright then, you got there first ;0)

Jes
0
 
stevbeCommented:
sometimes it take a while for the system to post , catch up, email ... I get dizzy myself just following the threads sometimes :-)
0
 
MarcGraffAuthor Commented:
Thanks everyone!

   - Marc
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now