Procedure Name | Type | Description |
(Declarations) | Declarations | Declarations and private variables for the modAccessInformation module. |
GetAccessHWnd | Procedure | Get the window handle (Hwnd) to the Access application. If you are going to use the Windows API, there are often times when you will have to pass a window handle of your application to Windows. In most cases, that handle will be the handle of Access itself. This procedure returns that handle. |
GetAccessVersion | Procedure | Get the Access version number. |
GetCodeDBName | Procedure | Get the name of the currently executing library database (without the path). |
GetCodeDBNamePath | Procedure | Get the path and name of the currently executing library database. |
GetCodeDBPath | Procedure | Get the path of the currently executing library database. |
GetCurrentDBName | Procedure | Get the name of the current database (without the path). |
GetCurrentDBNamePath | Procedure | Get the path and name of the current database. |
GetCurrentPath | Procedure | Get the path of current database. |
GetDatabaseVersion | Procedure | Get the Jet Engine version of the current database (for MDBs, not ADPs). |
IsADP | Procedure | Determine if the current database is an ADP. |
IsJetDatabase | Procedure | Determine if the current database is an Access Jet database file (ACCDB or MDB). |
IsACCDB | Procedure | Determine if the current database is an ACCDB file. |
IsMDB | Procedure | Determine if the current database is an MDB Jet Database file and not an ACCDB file. |
IsDatabaseReplica | Procedure | Determine if the current Jet database is a replica (for MDBs, not ADPs). |
IsRuntime | Procedure | Determine if the Access runtime version is currently running. |
' Example of modAccessInformation ' ' To use this example, create a new module and paste this code into it. ' Then run the procedure by putting the cursor in the procedure and pressing: ' F5 to run it, or ' F8 to step through it line-by-line (see the Debug menu for more options) Private Sub Example_modAccessInformation() ' Comments: Examples of using the modAccessInformation module to retrieve information on the currently running Access version and ' database's format type, version, file name, path, etc. using Access VBA. ' See the Immediate Window for results. ' Get the Access version Debug.Print "Access version: " & GetAccessVersion() ' Get the Access (Jet) database version Debug.Print "Database version: " & GetDatabaseVersion() ' What kind of database is this? Debug.Print "Is ADP : " & IsADP() Debug.Print "Is Jet : " & IsJetDatabase() Debug.Print "Is ACCDB: " & IsACCDB() Debug.Print "Is MDB : " & IsMDB() Debug.Print ' -------------------------------------------------------- ' Examples using the current database ' Get the current database file name without path Debug.Print "Current database Name: " & GetCurrentDBName() ' Get the current database path without file name Debug.Print "Current path: " & GetCurrentPath() ' Get the current database name and full path Debug.Print "Current database name and path: " & GetCurrentDBNamePath() Debug.Print ' -------------------------------------------------------- ' Examples of using getting the Code Database information. ' The Code Database is different from the Current database if it is being run from an Access library or add-in. ' Get the current code database file name without path Debug.Print "Code database name: " & GetCodeDBName() ' Get the current code database path without file name Debug.Print "Code database path: " & GetCodeDBPath() ' Get the current code database name and full path Debug.Print "Code database name and path: " & GetCodeDBNamePath() Debug.Print ' -------------------------------------------------------- ' Check to see whether Access is the runtime version If IsRuntime() Then Debug.Print "App is in runtime mode" Else Debug.Print "App is not in runtime mode" End If ' Is this a replica database If IsDatabaseReplica() Then Debug.Print "Database is a replica" Else Debug.Print "Datbase is not a replica" End If ' Get the Access window handle Debug.Print "Access window handle: " & GetAccessHWnd() End Sub
The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.
Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!
Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!
"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."
Van T. Dinh, Microsoft MVP