[AccessD] Conditional compile based on Office version

Heenan, Lambert Lambert.Heenan at AIG.com
Fri Apr 29 15:20:33 CDT 2005


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



More information about the AccessD mailing list