First Published 24 Sept 2023
This article discusses some of the SysCmd (system command) actions available in Access.
The syntax is: SysCmd(Action, Argument2, Argument3) where the Action is required and the other 2 arguments are used in certain cases
Several of these are fully documented at AcSysCmdAction enumeration (Access) as follows:
1. Documented SysCmd values
Value | Name | Description | Comment |
---|---|---|---|
1 | acSysCmdInitMeter | Initializes the progress meter. You must specify the argument1 and argument2 arguments when you use this action. | |
2 | acSysCmdUpdateMeter | Updates the progress meter with the specified value. | You must specify the text argument when you use this action. |
3 | acSysCmdRemoveMeter | Removes the progress meter. | |
4 | acSysCmdSetStatus | Sets the status bar text to the text argument. | |
5 | acSysCmdClearStatus | Provides information on the state of a database object. | |
6 | acSysCmdRuntime | Returns True (1) if a run-time version of Microsoft Access is running. | |
7 | acSysCmdAccessVer | Returns the version number of Microsoft Access. | |
8 | acSysCmdIniFile | Returns the name of the .ini file associated with Microsoft Access. | |
9 | acSysCmdAccessDir | Returns the name of the directory where Msaccess.exe is located. | |
10 | acSysCmdGetObjectState | Returns the state of the specified database object. | You must specify argument1 and argument2 when you use this action value. |
11 | acSysCmdClearHelpTopic | ||
12 | acSysCmdProfile | Returns the /profile setting specified by the user when starting Microsoft Access from the command line. | Not used with ACCDB files |
13 | acSysCmdGetWorkgroupFile | Returns the path to the workgroup file (System.mdw). | Not used in ACCDB files |
603 | acSysCmdCompile | Create an ACCDE file from ACCDB (or MDE from MDB) | Undocumented for over 20 years. Officially named and supported from Access version 2308 onwards |
In each case, you can either use the SysCmd enumeration value or its name.
For example SysCmd (7) and SysCmd(acSysCmdAccessVer) will both return the same value e.g. 14.0 in Access 2010 or 16.0 in Access 2016 or later
The most recent addition to this list, SysCmd(603) is used to convert an external database from an ACCDB (or MDB file) to a compiled version (ACCDE/MDE).
The syntax used is: appAcc.SysCmd 603, strACCDBSourcePath, strACCDEDestinationPath where appAcc is a Access object used in automation.
For more details, see my article Create ACCDB & ACCDE Files Using Code
2. Undocumented SysCmd values
There are a number of other very useful SysCmd values that are undocumented and therefore not supported.
Information about each of these is elusive with the most comprehensive list currently available at the excellent website run by Wayne Phillips: EverythingAccess.com
Most of the following information is taken from that site:
Value | Description | Comment | Notes (see below) |
---|---|---|---|
500 | Count VBA references (Access 97 only) | Return value is the same as Access.References.Count. | Discontinued |
504 | Save all modules - requires Flag value | SysCmd 504,16483: save and compile all modules SysCmd 504,16484: save all modules without compiling |
|
555 | create MSysIMEXSpecs & MSysIMEXColumns system tables | The two system tables used to store import/export configurations are not created by default. Very useful to create IMEX specs in an external database |
|
602 | Compact database without repair (Access 97 only) | Must be run from another application SysCmd(602, strPathSourceMdb, [strPathDestinationMdb]) | Discontinued |
605 | Convert current database to Access 97 format (A2000-2007 only) | SysCmd(605, strPathOutput) | Discontinued |
607 | Convert to ADP project without tables / queries (A2000-2007 only) | SysCmd(607,strProjectPath) | Discontinued |
608 | View Office Assistant Tips as Strings (A2000+) | SysCmd(608, intTipID) | Discontinued |
609 | Returns the PID (Process ID) of the currently running MSAccess.exe process | Discontinued | |
710 | Set Application Instance Keyboard Type | SysCmd(710, InputLocaleID) This affects the current application instance only and is not saved with the database |
|
711 | Get Application Instance Keyboard Type | This command returns the current InputLocaleID used by the application | |
712 | Get IPictureDisp from Image Control (A2000+) | Returns a pointer to the IPictureDisp interface behind an image control. | |
714 | Are any objects in Design View? | Returns True if any form/report/macro/module is open in design view. Otherwise False | |
715 | Returns Access major build version e.g. 16907 | Can combine with SysCmd(7) e.g. 16.0.16907 There is no SysCmd action to return the minor build version. |
See my article In Praise Of SysCmd(555) for details on using this specific action to manage import/export specifications in external databases using automation.
I recently submitted a formal request for the most useful of these undocumented SysCmd values that still work in current versions to be officially supported / documented.
In particular, SysCmd values 504, 555 and 715.
The Notes column above will be updated if/when this happens.
I have also asked that a new SysCmd value (e.g. 911) be created that will return the full Access version, build and bitness information.
For example: Access 365 32-bit Version 2310 (Build 16907.20000 Click to Run) - Beta Channel
All of this information (and more) can be obtained using my free Access/Windows Version Checker add-in for Access.
However, at the moment, in order to get all this information using code, I have to use several VBA functions including WMI code, check multiple registry settings
and perform a web scrape from an online Microsoft help article to get the YYMM version number! It works and is very fast but also extremely convoluted!
NOTE:
1. If you support these requests, PLEASE vote for them in the Access feedback portal:
Please officially support these undocumented SysCmd actions
Create a new SysCmd action to return the full Office version / build & bitness info
2. If you are know any other undocumented SysCmd actions not listed above, please let me know using the Feedback form below so I can add them to this article.
Feedback
Please use the contact form below to let me know whether you found this article interesting/useful or if you have any questions/comments.
Please also consider making a donation towards the costs of maintaining this website. Thank you
Colin Riddington Mendip Data Systems Last Updated 24 Sept 2023
Return to Access Blog Page
|
Return to Top
|