/获取josn对象 串长度
在技巧12中,我们展示了如何使用SysCmd()函数在Access中显示进度表。 现在,通过使用具有不同操作参数的相同功能,我们将演示如何返回特定的访问信息以及确定对象(表,窗体,报表,宏,模块等)的状态。 我决定不对代码显示进行概述,而是决定对代码进行更充分的注释,因为在大多数情况下,代码将是自解释的。 然后将显示示例输出,以演示代码的最终结果。
- 检索访问特定信息 :
输出值Debug.Print "1) The Main Access Directory is: " & SysCmd(acSysCmdAccessDir) Debug.Print "2) The Access Version is: " & SysCmd(acSysCmdAccessVer) Debug.Print "3) The Path to the Access Woekgroup File is: " & SysCmd(acSysCmdGetWorkgroupFile) Debug.Print "4) The Name of the .ini File associated with Access is: " & SysCmd(acSysCmdIniFile) Debug.Print "5) Is this Version of Access the Runtime Version?: " & IIf(SysCmd(acSysCmdRuntime), "Yes", "No") Debug.Print "6) The /profile setting specified by the user when starting Microsoft Access from the command line: " & IIf(IsNull(SysCmd(acSysCmdProfile)), "None Specified", SysCmd(acSysCmdProfile))
------------------------------------------The Main Access Directory is: C:\Program Files\Microsoft Office\Office\ The Access Version is: 9.0 The Path to the Access Woekgroup File is: C:\PROGRA~1\MICROS~2\Office\SYSTEM.MDW The Name of the .ini File associated with Access is: msacc30.ini Is this Version of Access the Runtime Version?: No The /profile setting specified by the user when starting Microsoft Access from the command line: None Specified
- 要确定访问对象的状态:
ObjectState = SysCmd(action[, objecttype][, objectname]) 'objecttype can be 1 of the following: 'acTable, acQuery, acForm, acReport, acMacro, 'acModule, acDataAccessPage, acDefault, 'acDiagram, acServerView, acStoreProcedure 'An Object can be in one of four possible states or variations thereof: 'return Value of 0 = not open or non-existent 'acObjStateOpen = 1 'acObjStateDirty = 2 (Changed but not saved ) 'return Value of 3 = Open and Dirty 'acObjStateNew = 4 'return Value of 5 = Open and New 'return Value of 7 = Open, Dirty, and New Debug.Print "State of Form3: " & SysCmd(acSysCmdGetObjectState, acForm, "Form3") Debug.Print "State of rptFinance: " & SysCmd(acSysCmdGetObjectState, acReport, "rptFinance") Debug.Print "State of tblEmployee: " & SysCmd(acSysCmdGetObjectState, acTable, "tblEmployees") Debug.Print "State of qryCustomers: " & SysCmd(acSysCmdGetObjectState, acQuery, "qryCustomers") Debug.Print "State of mcrOpenDatabase: " & SysCmd(acSysCmdGetObjectState, acMacro, "mcrOpenDatabase") Debug.Print "State of mdlUtilities: " & SysCmd(acSysCmdGetObjectState, acModule, "mdlUtilities")
- 输出值
State of Form3: 1 (Open) State of rptFinance: 0 (Not Open or Non-Existent) State of tblEmployee: 5 (Open and New) State of qryCustomers: 3 (Open and Dirty) State of mcrOpenDatabase: 7 (Open, Dirty, and New) State of mdlUtilities: 0] (Not Open or Non-Existent)
翻译自: https://bytes.com/topic/access/insights/649352-obtain-access-information-state-object
/获取josn对象 串长度