Solved

App.Path in vba?

Posted on 2003-11-03
8
1,148 Views
Last Modified: 2008-03-06
How would I ask access what my DB path is? like App.Path is vb?

   - Marc
0
Comment
Question by:MarcGraff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Expert Comment

by:Benjamin_Luk
ID: 9676389
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
 
LVL 77

Accepted Solution

by:
peter57r earned 125 total points
ID: 9676532
currentproject.path

Pete
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9678272
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Expert Comment

by:SoggyP
ID: 9678316
Hi Folks,

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

Later,

Jes
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9678405
Hi Jes,  that is what my post does ...
0
 

Expert Comment

by:SoggyP
ID: 9678438
Hi Folks,

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

Jes
0
 
LVL 39

Expert Comment

by:stevbe
ID: 9678471
sometimes it take a while for the system to post , catch up, email ... I get dizzy myself just following the threads sometimes :-)
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9678537
Thanks everyone!

   - Marc
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question