473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,385 developers and data experts.

Obtain Access Information/State of an Object

ADezii
8,834 Expert 8TB
In Tip #12, we showed how to display a Progress Meter within Access by using the SysCmd() Function. By using this same Function, with different Action Arguments, we will now demonstrate how you can return specific Access information as well as determining an Object's (Table, Form, Report, Macro, Module, etc) State. Instead of preceding the code display with an Overview, I decided to more fully comment the code, since for the most part it will be self explanatory. Sample output will then be shown to demonstrate the code's end result.
  1. To Retrieve Access Specific Information:
    Expand|Select|Wrap|Line Numbers
    1. Debug.Print "1) The Main Access Directory is: " & SysCmd(acSysCmdAccessDir)
    2. Debug.Print "2) The Access Version is: " & SysCmd(acSysCmdAccessVer)
    3. Debug.Print "3) The Path to the Access Woekgroup File is: " & SysCmd(acSysCmdGetWorkgroupFile)
    4. Debug.Print "4) The Name of the .ini File associated with Access is: " & SysCmd(acSysCmdIniFile)
    5. Debug.Print "5) Is this Version of Access the Runtime Version?: " & IIf(SysCmd(acSysCmdRuntime), "Yes", "No")
    6. 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))
    OUTPUT
    Expand|Select|Wrap|Line Numbers
    1.  The Main Access Directory is: C:\Program Files\Microsoft Office\Office\
    2. The Access Version is: 9.0
    3. The Path to the Access Woekgroup File is: C:\PROGRA~1\MICROS~2\Office\SYSTEM.MDW
    4. The Name of the .ini File associated with Access is: msacc30.ini
    5. Is this Version of Access the Runtime Version?: No
    6. The /profile setting specified by the user when starting Microsoft Access from the command line: None Specified
    ------------------------------------------
  2. To Determine the State of an Access Object:
    Expand|Select|Wrap|Line Numbers
    1. ObjectState = SysCmd(action[, objecttype][, objectname])
    2. 'objecttype can be 1 of the following:
    3. 'acTable, acQuery, acForm, acReport, acMacro,
    4. 'acModule, acDataAccessPage, acDefault, 
    5. 'acDiagram, acServerView, acStoreProcedure
    6.  
    7. 'An Object can be in one of four possible states or variations thereof:
    8. 'return Value of 0 = not open or non-existent
    9. 'acObjStateOpen = 1
    10. 'acObjStateDirty = 2 (Changed but not saved )
    11. 'return Value of 3 = Open and Dirty
    12. 'acObjStateNew = 4
    13. 'return Value of 5 = Open and New
    14. 'return Value of 7 = Open, Dirty, and New
    15.  
    16. Debug.Print "State of Form3: " & SysCmd(acSysCmdGetObjectState, acForm, "Form3")
    17. Debug.Print "State of rptFinance: " & SysCmd(acSysCmdGetObjectState, acReport, "rptFinance")
    18. Debug.Print "State of tblEmployee: " & SysCmd(acSysCmdGetObjectState, acTable, "tblEmployees")
    19. Debug.Print "State of qryCustomers: " & SysCmd(acSysCmdGetObjectState, acQuery, "qryCustomers")
    20. Debug.Print "State of mcrOpenDatabase: " & SysCmd(acSysCmdGetObjectState, acMacro, "mcrOpenDatabase")
    21. Debug.Print "State of mdlUtilities: " & SysCmd(acSysCmdGetObjectState, acModule, "mdlUtilities")
  3. OUTPUT
    Expand|Select|Wrap|Line Numbers
    1. State of Form3: 1 (Open)
    2. State of rptFinance: 0 (Not Open or Non-Existent)
    3. State of tblEmployee: 5 (Open and New)
    4. State of qryCustomers: 3 (Open and Dirty)
    5. State of mcrOpenDatabase: 7 (Open, Dirty, and New)
    6. State of mdlUtilities: 0] (Not Open or Non-Existent)
May 20 '07 #1
0 7255

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mahesh Hardikar | last post by:
Hi , I have been trying to connect to access database from SQL Server 7.0. This machine is having 7.0 as a default instance and 2000 as a named instance. Also the machine doesn't have access...
6
by: Ryan Muller | last post by:
My company just upgraded from Access 97 to Access 2003 today and we are having some issues in a database that generates a Word document from information selected in a form. Here is the code we...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
15
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a...
3
by: Shawn | last post by:
Hi. In my application I store information about the user in the session object. Since I'm storing sensitive information I encrypt it before storing and decrypt it when I need to use it again. The...
4
by: Nick Gilbert | last post by:
Hi, Is it possible to access the Session of an arbitary user from an aspx page? On an e-commerce site, I am notified of payment success via a callback from the payment server to an ASPX page...
1
by: Rameel | last post by:
Friends, I'm probably being more critical with VB.Net Windows application. I have Developed VisualStudio 20005 VB.Net Windows application how willl i be able to save a specific record into my...
2
by: RSH | last post by:
I have a situation where I have a page called "HiddenFrame.aspx" that contains a public property exposing the value of a textbox called "TextBox1" that is in a hiddenframe. Loaded in the main...
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.