[AccessD] Compiler directives

Arthur Fuller fuller.artful at gmail.com
Wed Nov 3 14:48:49 CDT 2010


Sorry to ask for the answer to an old question, folks, but advanced age and
lack of practice is causing serious memory lapses.



The central problem is that the client and I run the app in different
environment, and that this in turn causes different definitions of various
directory locations, etc.



>From within a given module, I know how to check for various compile options,
but I cannot recall how to define them in the first place.



For example, a snippet ...



<vba>

Dim strTemplateDir as String

#If DEVELOPER Then

      strTemplateDir = "C:\SAS\Documents\"

#Else

      strTemplateDir = "C:\Documents And Settings\All Users\Documents\"

#End If

Dim strFileName as String

strFileName = strTemplateDir & "MyFile.dotx"

</vba>



The above sample code is required several times in various modules, so I
thought that the simplest way was to pass a compile argument DEVELOPER which
would compile the appropriate lines.



Perhaps I should add that I am not in search of run-time arguments, but
rather compile-time arguments. However, if this is not the way to go, then I
shall be willing to entertain the run-time arguments alternative.

So I want to define DEVELOPER while I'm working at home, but also issue to
CLIENT a version without this argument, so that when she compiles it, the
app references her directory structure and not mine.



To further complicate things, the client in question has a nasty habit of
revising the Word templates and appending the revision-date to the filename.
I want to eliminate these complications, perhaps like this:



Define a constant MyTemplate, with a value such as MyFile_2010-11-02.dotx.

Refer to said constant using #MyTemplate in all the code.

When she or I choose to provide a new version of the template's filename,
then all that is required is to revise the arguments, e.g. not touch a line
of code.



Can anyone prod my failing memory and remind me how to define these?



I should add that I am developing in A2K7 while the client is running in
A2K10. I don't know whether this complicates things further.



TIA,

Arthur



More information about the AccessD mailing list