Solved

App.Path in vba?

Posted on 2003-11-03
8
1,146 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

733 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