FileSystemObject

C

CT

Using object.GetAbsolutePathName(pathspec)to get current
directory path, but "object" not current database after
using open dialog box to select an external database. How
to I "re-point" to current database?

CT
 
D

Dirk Goldgar

CT said:
Using object.GetAbsolutePathName(pathspec)to get current
directory path, but "object" not current database after
using open dialog box to select an external database. How
to I "re-point" to current database?

Please post your code.
 
C

CT

'in module
Option Compare Database
Dim fso
Dim fo

Function CURRENT_DIR()
Set fso = CreateObject("Scripting.FileSystemObject")
CURRENT_DIR = fso.GetAbsolutePathName("c:")
End Function

'in current database form where strEXTDB is an external
database name.
strCURRENTDIRVALUE = CURRENT_DIR & "\" & strEXTDB

When I use an open dialog box to select another external
database* (not the same name as represented by strEXTDB)
then CURRENT_DIR returns the path to selected *database
instead of the current database. Works fine when I don't
use the open dialog box bring back a path string.

Open dialog box module uses following functions:
Function aht_apiGetOpenFileName
Function aht_apiGetSaveFileName

CT
 
D

Dirk Goldgar

CT said:
'in module
Option Compare Database
Dim fso
Dim fo

Function CURRENT_DIR()
Set fso = CreateObject("Scripting.FileSystemObject")
CURRENT_DIR = fso.GetAbsolutePathName("c:")
End Function

'in current database form where strEXTDB is an external
database name.
strCURRENTDIRVALUE = CURRENT_DIR & "\" & strEXTDB

When I use an open dialog box to select another external
database* (not the same name as represented by strEXTDB)
then CURRENT_DIR returns the path to selected *database
instead of the current database. Works fine when I don't
use the open dialog box bring back a path string.

Open dialog box module uses following functions:
Function aht_apiGetOpenFileName
Function aht_apiGetSaveFileName

I suspect you need to use the ahtOFN_NOCHANGEDIR flag when you call
aht_apiGetOpenFileName. Otherwise, the dialog will change the current
directory to the one from which you opened the file.
 
C

CT

Set flag - worked. Thank you.

CT
-----Original Message-----


I suspect you need to use the ahtOFN_NOCHANGEDIR flag when you call
aht_apiGetOpenFileName. Otherwise, the dialog will change the current
directory to the one from which you opened the file.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Top