Flexible or relative path for import 
Author Message
 Flexible or relative path for import

I have created code to import text files into a database.
I would like one of two options for the path location of
these text files.

1. For them to be relative to where the database is
stored.  As long as the text files are in the same folder,
all is fine.

2. To have a control on the form in the database that
would allow the user to "browse" to select the folder the
text files are located in.  Then to reference that control
in identifying the path of these files.

Any help?



Tue, 24 May 2005 23:35:07 GMT  
 Flexible or relative path for import
You don't say what version of ms-access you are using.

If you are using a2002(xp), then there is a file dialog you can use to open
and browse to a file name.

For other versions of ms-access, a very low code solution is to use the
common dialogs control.

The other popular method is to use a call to the windows API. There is a
example that everyone uses at:

http://www.mvps.org/access/api/api0001.htm

For making things relative. you can grab the path name as follows

strDir = currentdb.name

The above is the full path name. So, we need to strip off the yourapp.mdb
(name of the mdb, and the result will be our path). Hence

strDir = left(strdir),len(strdir) - len(dir(strdir)))

At this point, strDir will be the full pathname to your current dir, and
thus you can now work relative to the dir.

--
Albert D. Kallal
Edmonton, Alberta Canada

www.attcanada.net/~kallal.msn



Wed, 25 May 2005 06:18:13 GMT  
 Flexible or relative path for import
Or use
    curDir = CurrentProject.Path
for relative paths.

Bob R.



Quote:
> You don't say what version of ms-access you are using.

> If you are using a2002(xp), then there is a file dialog you can use to
open
> and browse to a file name.

> For other versions of ms-access, a very low code solution is to use the
> common dialogs control.

> The other popular method is to use a call to the windows API. There is a
> example that everyone uses at:

> http://www.mvps.org/access/api/api0001.htm

> For making things relative. you can grab the path name as follows

> strDir = currentdb.name

> The above is the full path name. So, we need to strip off the yourapp.mdb
> (name of the mdb, and the result will be our path). Hence

> strDir = left(strdir),len(strdir) - len(dir(strdir)))

> At this point, strDir will be the full pathname to your current dir, and
> thus you can now work relative to the dir.

> --
> Albert D. Kallal
> Edmonton, Alberta Canada

> www.attcanada.net/~kallal.msn



Wed, 25 May 2005 11:56:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Parsing an HTML Document - Change Relative paths to fully qualified paths

2. Best method of determining path, relative path and/or flie name

3. convert absolut path to relative path

4. Creating relative directory path given fully-qualified path

5. Error trying to set relative path on linked powerpoint presentation

6. I want absolute path in hyperlinks and linked pitures (word makes them relative)

7. Relative Path to Access DB in VB.NET

8. Crystal Reports - relative path in report file name

9. relative path

10. Open Statement Using Relative Path

11. Relative paths in projects

12. Relative database path

 

 
Powered by phpBB® Forum Software