473,748 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change conditional compiler constants using VBA?

I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew
Nov 12 '05 #1
13 6102
> properties to inhibit user access, recompile, then build a .MDE ready
to deliver. I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
My experience was that MDE's could not see CC constants defined
as project properties in the IDE when the build was scripted using
syscmd 603. Have you tried this? Which version of Access are you
using?

(david)

=============== =============== ===========
"Andrew" <an************ **************@ bigpond.com> wrote in message
news:cb******** *************** **@posting.goog le.com... I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew

Nov 12 '05 #2
Hi David,

syscmd 603? I know syscmd acSysCmdRuntime (which = 6).

This is running under Access 2k, A2k runtime, and AXP. The .MDE seems to be
handling the CCs no problem, as long as I remember to recompile after
setting them.

Andrew

"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message
news:40******** *************** @news.syd.swift dsl.com.au...
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in


My experience was that MDE's could not see CC constants defined
as project properties in the IDE when the build was scripted using
syscmd 603. Have you tried this? Which version of Access are you
using?

(david)

=============== =============== ===========
"Andrew" <an************ **************@ bigpond.com> wrote in message
news:cb******** *************** **@posting.goog le.com...
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew


Nov 12 '05 #3
appobj.syscmd 603 "sfile1", "sfile2"

is one of the ways of making an MDE from an MDB.

it does not require that you have the mdb as the current
database, which is probably why it looses the conditional
compile constants.

Are you scripting the 'make mde' phase of your build?
If so, which method are you using?

(david)
"Hopeful" <Li**@in.hope > wrote in message
news:7H******** **********@news-server.bigpond. net.au...
Hi David,

syscmd 603? I know syscmd acSysCmdRuntime (which = 6).

This is running under Access 2k, A2k runtime, and AXP. The .MDE seems to be handling the CCs no problem, as long as I remember to recompile after
setting them.

Andrew

"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message
news:40******** *************** @news.syd.swift dsl.com.au...
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in


My experience was that MDE's could not see CC constants defined
as project properties in the IDE when the build was scripted using
syscmd 603. Have you tried this? Which version of Access are you
using?

(david)

=============== =============== ===========
"Andrew" <an************ **************@ bigpond.com> wrote in message
news:cb******** *************** **@posting.goog le.com...
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew



Nov 12 '05 #4
Ah, that's a useful command.

No, I'd not got as far as scripting the 'Make .MDE'. The steps that I take
as standard are:
0. Update version information using a hidden local table and hidden form,
that then exports a version history text file to include in the set-up
1. run procedure to apply custom toolbars/menubars to forms and reports
(never use macros...uuggh! )
2. run procedure to switch off all database properties that allow the user
to get behind the scenes
3. manually change the CC constant(s)
4. recompile (occasionally I'll precede the whole shebang with a command
line decompile as well to clean out the file)
5. manually run 'Make .mde'

After the 'Make .mde' the app reopens now paying attention to the new CC
constants, and behaving as it should in production.

All the routines are run using an AutoKeys shortcut that calls a single
wrapper routine that starts with a message box to allow you to toggle things
on or off, and passes this on to the other routines. This allows me to get
back in to the mdb to carry on with the next round of work.

The whole lot then gets pulled together with any supporting files, usually
using Inno setup (or the dread P & D wizard for runtime installations until
I can figure out an Inno script for the runtime files). Since it's the .mde
is delivered, of course there's not a load that the user can do should the
stumble across the AutoKeys shortcut, and the message encourages them to
cancel anyhow. The worst that could happen is that they might manage to
break into code, and for the user base I'm dealing with, that's not a
threat!

I've written a small VB app that wraps up the decompile process, and I was
thinking it might be possible to write another to wrap up the entire build
process. So the first step would be to work out how to change the CC
constants, then recompile, then 'Make .mde' all from outside. It would be a
very handy tool if I can pull it off.

Where did you come across the syscmd 603? Do you know of any other
undocumented syscmd tricks?

Here's me asking for all your secrets - sorry! Still, if you don't ask...

All the best,

Andrew

"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message
news:40******** *************** @news.syd.swift dsl.com.au...
appobj.syscmd 603 "sfile1", "sfile2"

is one of the ways of making an MDE from an MDB.

it does not require that you have the mdb as the current
database, which is probably why it looses the conditional
compile constants.

Are you scripting the 'make mde' phase of your build?
If so, which method are you using?

(david)
"Hopeful" <Li**@in.hope > wrote in message
news:7H******** **********@news-server.bigpond. net.au...
Hi David,

syscmd 603? I know syscmd acSysCmdRuntime (which = 6).

This is running under Access 2k, A2k runtime, and AXP. The .MDE seems
to be
handling the CCs no problem, as long as I remember to recompile after
setting them.

Andrew

"david epsom dot com dot au" <david@epsomdot comdotau> wrote in message
news:40******** *************** @news.syd.swift dsl.com.au...
> properties to inhibit user access, recompile, then build a .MDE ready > to deliver.

> I'd really like to automate the build, and the one step I can't crack > is setting the CC constant. No, I don't want to set them inline in

My experience was that MDE's could not see CC constants defined
as project properties in the IDE when the build was scripted using
syscmd 603. Have you tried this? Which version of Access are you
using?

(david)

=============== =============== ===========
"Andrew" <an************ **************@ bigpond.com> wrote in message
news:cb******** *************** **@posting.goog le.com...
> I use conditional compiler constants, set through the VBA IDE in
> Tools, <projectname> Properties, that I refer to throughout my code to > control which code is used during development, and which during
> production. Usually, this only wraps code used to control quitting
> the whole app versus just shutting a form, but it can also control
> many other things.
>
> However, as part of the build before delivering an update, I have to
> remember to change the CC constants, as well as run code to set menu
> and command bars for all the forms and reports, remove default project > properties to inhibit user access, recompile, then build a .MDE ready > to deliver.
>
> I'd really like to automate the build, and the one step I can't crack > is setting the CC constant. No, I don't want to set them inline in
> the code, nor by using them in a command line in the shortcut to run
> the app.
>
> Any ideas?
>
> TIA
>
> Andrew



Nov 12 '05 #5
On 1 Mar 2004 06:16:38 -0800, an************* *************@b igpond.com
(Andrew) wrote:
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew


In addition to other comments, I wanted to add something I've learned in my
own coding process. I've had some troubles with precompiler constants, and I
found some alternative schemes I now tend to prefer.

Problems:
1. Sometimes, precompiler conditional code can be really messy, especially
when it overlaps some standard VBA conditional code.
2. Sometimes the editor can get really confused.
3. Sometimes, it messes up Decompile.

Alternatives:
1. Use standard VBA conditions. In most cases, the performance hit is
immesurably small.
2. Create standard and stub versions of optional code, and comment out the
standard or stub version as desired.

Nov 12 '05 #6
"Andrew" <an************ **@webster.org> wrote in
news:LG******** **********@news-server.bigpond. net.au:
Where did you come across the syscmd 603? Do you know of any other
undocumented syscmd tricks?


This is a Klingon discovery. As a real programmer, you would not want to use
it?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #7
Hmmm.

Make it so.

"Lyle Fairfield" <Mi************ @Invalid.Com> wrote in message
news:Xn******** ***********@130 .133.1.4...
"Andrew" <an************ **@webster.org> wrote in
news:LG******** **********@news-server.bigpond. net.au:
Where did you come across the syscmd 603? Do you know of any other
undocumented syscmd tricks?
This is a Klingon discovery. As a real programmer, you would not want to

use it?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #8
Hi Steve,

Thanks for joining in.

You've got me thinking. What I want to do is simply flip a flag somewhere,
so that in 'Developer mode' certain code runs (e.g. DoCmd.Close instead of
DoCmd.Quit), while in 'Production mode' other code runs (e.g. DoCmd.Quit
instead of DoCmd.Close). There are usually a couple of other things spread
out around the code, so CC constants seem to provide a one-stop-shop for
turning them all on or off.

However, what I could do, so it can be done from code, is add a Custom
Database Property (or more than one), and flip that at the same time as I'm
running all the other database property code to enable/disable user access
to the clever stuff behind the scenes. Then wrap the conditional code with
a test that checks the state of the property, rather than a load of #If's.
If I was feeling particularly bright, I might make the property an integer
and using bitwise comparison to set/test several values at the same time.

Hmmm.

I'll have to go and experiment.

However, it's late now here in Oz, so I'm going to leave it until tomorrow.

All the best,

Andrew

"Steve Jorgensen" <no****@nospam. nospam> wrote in message
news:cl******** *************** *********@4ax.c om...
On 1 Mar 2004 06:16:38 -0800, an************* *************@b igpond.com
(Andrew) wrote:
I use conditional compiler constants, set through the VBA IDE in
Tools, <projectname> Properties, that I refer to throughout my code to
control which code is used during development, and which during
production. Usually, this only wraps code used to control quitting
the whole app versus just shutting a form, but it can also control
many other things.

However, as part of the build before delivering an update, I have to
remember to change the CC constants, as well as run code to set menu
and command bars for all the forms and reports, remove default project
properties to inhibit user access, recompile, then build a .MDE ready
to deliver.

I'd really like to automate the build, and the one step I can't crack
is setting the CC constant. No, I don't want to set them inline in
the code, nor by using them in a command line in the shortcut to run
the app.

Any ideas?

TIA

Andrew
In addition to other comments, I wanted to add something I've learned in

my own coding process. I've had some troubles with precompiler constants, and I found some alternative schemes I now tend to prefer.

Problems:
1. Sometimes, precompiler conditional code can be really messy, especially when it overlaps some standard VBA conditional code.
2. Sometimes the editor can get really confused.
3. Sometimes, it messes up Decompile.

Alternatives:
1. Use standard VBA conditions. In most cases, the performance hit is
immesurably small.
2. Create standard and stub versions of optional code, and comment out the standard or stub version as desired.

Nov 12 '05 #9
Let us know how that goes.

On Wed, 03 Mar 2004 13:17:48 GMT, "Andrew" <an************ **@webster.org>
wrote:
Hi Steve,

Thanks for joining in.

You've got me thinking. What I want to do is simply flip a flag somewhere,
so that in 'Developer mode' certain code runs (e.g. DoCmd.Close instead of
DoCmd.Quit), while in 'Production mode' other code runs (e.g. DoCmd.Quit
instead of DoCmd.Close). There are usually a couple of other things spread
out around the code, so CC constants seem to provide a one-stop-shop for
turning them all on or off.

However, what I could do, so it can be done from code, is add a Custom
Database Property (or more than one), and flip that at the same time as I'm
running all the other database property code to enable/disable user access
to the clever stuff behind the scenes. Then wrap the conditional code with
a test that checks the state of the property, rather than a load of #If's.
If I was feeling particularly bright, I might make the property an integer
and using bitwise comparison to set/test several values at the same time.

Hmmm.

I'll have to go and experiment.

However, it's late now here in Oz, so I'm going to leave it until tomorrow.

All the best,

Andrew

"Steve Jorgensen" <no****@nospam. nospam> wrote in message
news:cl******* *************** **********@4ax. com...
On 1 Mar 2004 06:16:38 -0800, an************* *************@b igpond.com
(Andrew) wrote:
>I use conditional compiler constants, set through the VBA IDE in
>Tools, <projectname> Properties, that I refer to throughout my code to
>control which code is used during development, and which during
>production. Usually, this only wraps code used to control quitting
>the whole app versus just shutting a form, but it can also control
>many other things.
>
>However, as part of the build before delivering an update, I have to
>remember to change the CC constants, as well as run code to set menu
>and command bars for all the forms and reports, remove default project
>properties to inhibit user access, recompile, then build a .MDE ready
>to deliver.
>
>I'd really like to automate the build, and the one step I can't crack
>is setting the CC constant. No, I don't want to set them inline in
>the code, nor by using them in a command line in the shortcut to run
>the app.
>
>Any ideas?
>
>TIA
>
>Andrew


In addition to other comments, I wanted to add something I've learned in

my
own coding process. I've had some troubles with precompiler constants,

and I
found some alternative schemes I now tend to prefer.

Problems:
1. Sometimes, precompiler conditional code can be really messy,

especially
when it overlaps some standard VBA conditional code.
2. Sometimes the editor can get really confused.
3. Sometimes, it messes up Decompile.

Alternatives:
1. Use standard VBA conditions. In most cases, the performance hit is
immesurably small.
2. Create standard and stub versions of optional code, and comment out

the
standard or stub version as desired.


Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
12631
by: Joseph VanWagoner | last post by:
I want to know how to change the color and look of the <select> border. I wrote: SELECT { BORDER-COLOR:ORANGE; BORDER-STYLE:SOLID; BORDER-SIZE:2PX; } This works for everything, but <select>. Also, How can I change the look of the drop down list button using css?
0
1352
by: Victor Irzak | last post by:
Hello, I want to build two assemblies that use common c# code. I wish to use preprocessor. I defined a constant YABA in "Conditional compilation constants" in the property pages. So the line looks like this: DEBUG;TRACE;YABA Then in my code I have:
1
1241
by: Benne Smith | last post by:
I can't seem to use my normal compiler constants from inside a macro ? It's possible to define NEW constants inside the macro, but this is not what i need. Does anybody know a way to get to them from inside the macro ? Thanks, Benne
10
1380
by: Vladimir Kouznetsov | last post by:
#using <mscorlib.dll> #include <vcclr.h> public __gc class A {}; struct B { void f(A* e); gcroot<A*> e; }; int main() { B().f(new A()); // note that B b; b.f(new A)); works fine return 0;
3
8679
by: Jigar Mehta | last post by:
Hye, I am Jigar Mehta, currently, I am using AfxMessageBox where I need to change the caption of the messagebox using that function only... What I get is, the project name as the caption. I don't want to show my codename of the project to people in my final product, so, I want to change the caption of the messagebox to some different. so, how to do that??? is there any parameter which does this thing ???
1
1305
by: martin | last post by:
Hi, I am having a little trouble defining compiler constants and picking then up in my code. In the configuration manger I defined the constant "Martin" I then set the Project Configuration to "Martin" in the configuration manager.
0
1324
by: Sam Marrocco | last post by:
Is there a way to prevent a conditional compiler directive from "disabling" my #region/End Region statements? If I surround a block of code that contains #region statements with an #if/#EndIf block, when the #if is false, all code folding/formatting dissapears, making the code very unreadable. Any suggestions? -- ================================================================== Sam J. Marrocco Sr. Visual Effects Artist/R&D
2
1152
by: G.Ashok | last post by:
Hi, Is there any option/setting/attribute availble to detect the difference in the value specified for a Ccc on the build tab and used/given in the code? For example: DBEngine="Access" in build tab and #IF DBEngine = "MSAccess" in code. I want to detect the above kind of mistakes in the code. I just want to detect and give a compilation error.
1
9451
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works when the form is in its minimal size. However, when the form is maximized using the appropriate button the code that is supposed to set the location is ignored. When the form is switched back to the standard dimensions through the restore...
0
9528
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.