Solved

How to set VBA Options via Code

Posted on 2011-02-15
5
389 Views
Last Modified: 2013-11-27
Is it possible to set the VBA Options Compile On Demand and Background Compile via VBA code?
0
Comment
Question by:Milewskp
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:RgGray3
ID: 34901321
I haven't seen it....
I have code to toggle other Access options...  havent seen that one exposed....  though you have me curious.  So I am searching....

But, to what end?   why would you need/want to toggle this via code?

just curious....  
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 34903557
there is no way to set those in VBA
if you want to do it in codes, you have to change the registry setting

HKEY_CURRENT_USER\Software\Microsoft\VBA\6.0\Common


BackgroundCompile Dword   (0 = Unchecked, 1 = Checked)
CompileOnDemand, Dword  (0 = Unchecked, 1 = Checked)
0
 
LVL 1

Author Comment

by:Milewskp
ID: 34906719
hi RgGray3,
<why would you need/want to toggle this via code?>
I would like to be able to initialize these options to my preferred values whenever I open a database (in case I had chanegd them temporarily, or in case I copy my database to another PC).
0
 
LVL 11

Assisted Solution

by:RgGray3
RgGray3 earned 250 total points
ID: 34906829
Interesting...   It's not a setting I have given much thought to changing.

OK   well as stated by Capricorn1...  those settings are in the registry...  (Thanks Cap......) Sure enough those and a few others are hanging out there.
So you would need to update the registry..

There are API routines that allow you to read and write to the registry
(Angels..  tread carefully)
Create a wrapper to toggle the specific entries.

Check MS KB....

http://support.microsoft.com/kb/145679





0
 
LVL 1

Author Comment

by:Milewskp
ID: 34951763
Thanks for the help gents, I'll spilt the points.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now