Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the full databasepath in Access 97

Status
Not open for further replies.

MrStar

Programmer
Sep 30, 2002
53
DK
Does anybody know how I get the full path to the Currentdb.
If I use currentdb.name I get the old DOS format which can't hold more than 8 cahracters per directory. If it ios longer is has a ~ in the name.
 
Public Function GetPath() As String
' Give path without last "\"
Dim X, Y As Byte
Set dbCurrent = CurrentDb
Do
X = Y
Y = InStr(X + 1, dbCurrent.Name, "\")
Loop Until Y = 0
GetPath = Left(dbCurrent.Name, X - 1)
End Function "In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
Hi

Is this perhaps OS dependand, becuase in W98 / A97 I get full path as below:

debug.Print currentdb().Name
c:\437GRNDatabase\GRN_FE.mdb

event when > 8 chars in directory name
Hope this helps

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Not really OS Dependant, two functions get their data the same way, only the stuff that's done with it differs a bit.
(Matter of copy/paste in my case)

Main thing is that in CurrentDb().Name you find the full database path.
"In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
Thanks for your answers, but when I use
currentdb.name I get something like this:
C:\WORKBE~1\PRODVE~1\coda 97.mdb instead of
C:\WORKBENCH\PRODVERSION\coda 97.mdb.

I'm running Windows NT 4.0.
Could that be the problem ?
 
Hmmmz...

Tried it as well on a NT4.0 and it gave me just the full path.

Sorry, no idea why it doesn't in y'r case "In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
Hi

So we have W98 and WNT4.0 where it gives full path, but not on your PC, could it be a Windows setting?

Hope this helps

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top