Solved

How to set VBA Options via Code

Posted on 2011-02-15
5
391 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

831 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