[AccessD] Conditional compile based on Office version

Chris Mackin chris at denverdb.com
Sat Apr 30 12:23:09 CDT 2005


You can however, open the file, read the desired value and write that out to
the Conditional Compilation property, then close the db, open it with a
recompile and you're good.  So with a little work you can pull i toff no
problem.

The key, like so many other times, is in ADH, see their documentation of the
SetOption argument used to rewrite the Conditional Compilation value.  The
only real gotcha is that you must set ALL of the conidtional compilation
arguments at the same time. So if you have more than one, write them all
out, otherwise if you only set 1, the others are gone.

-Chris Mackin

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Heenan,
Lambert
Sent: Friday, April 29, 2005 2:21 PM
To: 'Access Developers discussion and problem solving'; 'John W. Colby'
Subject: RE: [AccessD] Conditional compile based on Office version


The conditional compilation feature of Access (and most other programming
environments) requires that you use only conditional compiler constants
(declared using #Const or the user interface [i.e. the dialog box you get to
in the VBA Ide under Tools {Project Name} Properties]).

So you cannot execute code during compilation to discover what version is
doing the compiling. You'll have to declare the constants yourself and set
them to the appropriate values prior to compiling. By declaring/setting
these in the project properties dialog you will be able to compile the code
without making any changes to it at all.

Also the properties dialog it the only place you can declare a 'public'
conditional constant that is visible in all modules.

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of John W. Colby
> Sent:	Friday, April 29, 2005 3:30 PM
> To:	'Access Developers discussion and problem solving'
> Subject:	[AccessD] Conditional compile based on Office version
>
> Does anyone know if it is possible to do a conditional compile based on
> the
> version number.  IOW, I have a line of code valid in OfficeXP (it
> references
> a control property valid in XP but not previously) so the code compiles
> correctly in XP but not in 2K.  I would like to use a #if #endif bracket
> around the code to just not compile that line of code if the version is
> 2K.
>
> John W. Colby
> www.ColbyConsulting.com
>
> Contribute your unused CPU cycles to a good cause:
> http://folding.stanford.edu/
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list