Ilona-
 
You don't need to address new questions to me - I'm not the only person
helping out here!  <s>
 
You can find the full path and name of the current database in the Name
property of CurrentDb.  All you need to do is scan for the last "\" and take
everything up to there.  In 2000 and later, there's a nice new InStrRev
function to scan a string from the back end, but that's not in 97, either.
So, I wrote my own:
 
Function InStrRev(strIn As String, strSearch As String) As Integer
' Emulates the VB6 function
Dim intI As Integer, intJ As Integer
 
    intI = Len(strIn) - Len(strSearch) + 1
    
    For intJ = intI To 1 Step -1
        If InStr(intJ, strIn, strSearch) <> 0 Then Exit For
        If intJ = 1 Then
            intJ = 0
            Exit For
        End If
    Next intJ
    InStrRev = intJ
        
End Function

Now to find the path, all you need is:
 
      strPath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\") - 1)

John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Ilona Wright
Sent: Saturday, June 17, 2006 8:09 AM
To: [email protected]
Subject: RE: [ms_access] CurDir help please



Hi John,
I am using the CurDir function to return the current path.
I am expecting the path of the .mdb using the function, but it returns the
ACCESS Default Database Folder.
Can you please tell me how to determine the current path?

I am using Acces 97. What I am trying to do is establish links to tables on
opening my switchboard form. The data tables are in a separate databse to
the application software, but I expect the tables database to reside in the
same folder as the application software database. So, if the switchboard
knows where it is, it can establish the links to the data tables. I want the
linking to be hidden from the user.
I hope this makes sense.
Thank you again in advance
Ilona

[Non-text portions of this message have been removed]



 


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/q7folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to