Solved

How to set VBA Options via Code

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

789 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