Solved

How VBA code can tell if it's not compiled, and how it can compile itself

Posted on 2010-11-29
5
275 Views
Last Modified: 2013-11-27
Is there a way you can tell if all of the VBA modules of a project are compiled or not (using a VBA procedure, that is)?
Can you run a VBA procedure to compile all modules of a VBA project (or at least all of the modules other than the one the procedure is in)?

Note:
EE expert Jim Dettman says there is an undocumented SYSCMD function (SysCmd(504, 16483) ) available in MS Access that will compile all modules, but advises not to use it. (Ref: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26639269.html#a34231494 ID:34230641)
0
Comment
Question by:Milewskp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 34231648

If application.IsCompiled =  True Then

   ' Do what ever

End If

mx
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 34231657
To compile all modules:

docmd.RunCommand acCmdCompileAllModules

mx
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 34231695
There is a RunCommand constant (two actually) that might work, but I have never tried either:

Docmd.RunCommand acCmdCompileAllModules

or

Docmd.RunCommand acCmdCompileAndSaveAllModules
You can check these out at Terry Wickenden's site: http://www.accessruncommand.com/index.htm
The second one actually contains a code example.

0
 
LVL 75
ID: 34231757
btw ... I tested docmd.RunCommand acCmdCompileAllModules (was well as IsCompiled) and they do work.

mx
0
 
LVL 1

Author Comment

by:Milewskp
ID: 34232007
Thanks mx!

Hi fyed,
I tried Terry's code. It appears to be unnecessarily complicated, since mx's one liners seems to work fine (for A2003 SP3 anyway).

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

734 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