Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Dealing with different paths to the same data from different computers

Last updated: 10 Nov 2002

Problems can arise when writing scripts in a database application that runs on a network when the precise path to the database tables or other files depends on what computer you are on. Eg on all the client computers the path might be \\Vaio\database\ or e:\data, but on the server computer the path to the same files may be \\Admin\database\ or c:\data. There are several ways of dealing with this depending on what you are doing.

If the files you are looking for are in the same path as the database application (ie. when you are running Approach locally, but the .apr's and data files are on the network), then declare a global string variable called, say, Path [ie put 'DIM Path as String' into (Globals)(Declarations) ] and initialize that variable to the current document path [ie put 'Path = CurrentDocument.Path' into (Globals) Initialize ]. ~However~, apparently there is a bug in v95 to v9.7 in which the Initialize sub doesn't always run (although I personally haven't every encountered this problem. It always works fine in my applications...). If you encounter this problem try putting the path command in a different global sub called, say StartUp, and then call StartUp from a MACRO called OPEN. Approach is designed to always run the a macro call OPEN if it is present when the application opens.

If it is not in the exact same path then you can use string functions to create other variations. For instance, a useful one I use a lot is the create and initialize a string variable that contains just the drive information: Drive = Left$(Path, 3).

If the path is unrelated and independent of the current document path and/or drive then you have a couple of options. One option is to the DOS SUBST command to create an alias of the same name on each computer that points to the network folder you want to access.

An alternate method is to create a text file on each computer which contains a declaration of a constant which contains the path for that computer. Eg. create a text file on every computer called "c:\data\path.txt". The contents of the file should be: 'Const Path = "\\Vaio\database\' or whatever the path is for that computer. Then, in (Globals)(Options) of the .apr put:

%INCLUDE "c:\lotus\MachineBackground.txt"

Then just use the 'Path' constant wherever you need to specify the path of the files.

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.