Tags: Base Extension Macro
Rating: ★ ★ ★ ☆ ☆
VBA for MSAccess emulator
Access2Base is a standard feature of LibreOffice. The 1.9.0 version (= last available version of the extension) is pre-installed in LibreOffice 6.1.
Later LibreOffice releases (6.2 ... 7.0) embed Access2Base fresher releases too (6.2.0 ... 7.0.0). The latter Access2Base versions are not available as an extension anymore and never will.
Download this software only if your LibreOffice version is <= 6.0.
This extension implements a LibO/AOO Basic library for Base applications.
The API is entirely inspired by VBA for MSAccess and its object model.
As such it is a tool helping people either to migrate their Access databases to Base OR to write code as if it was VBA OR to write their first macros.
It is much more intuitive and easy to learn than the standard UNO API. It is documented (online) in detail.
Version 1.9.0 was uploaded to this site on 11-Aug-2018.
The implemented macros include (among a huge list of functionalities):
- forms, dialogs and controls manipulations derived from the MSAccess object model
- an API for database access with the table, query, recordset and field objects
- actions with a syntax identical to their corresponding MSAccess macros/actions
- the DLookup, DSum, ... database functions
- the support of the shortcut notations like Forms!myForm!myControl
- a consistent errors and exceptions handler
- facilities for management of form and control events
The macros using the API may be stored both in Database documents (".odb" files) and in standalone (Writer/Calc/...) forms.
It is even possible to access data from Calc cell formulas.
(Only to have a first idea ...) Compare Access2Base with MSAccess VBA
LibreOffice Base with Access2Base
REM Open a form ...
REM Move a form to new left-top coordinates ...
Dim ofForm As Object
Set ofForm = Forms("myForm")
REM Get the value of a control ...
Dim ocControl As Object
ocControl = ofForm.Controls("myControl")
REM Hide a control ...
ocControl.Visible = False
REM ... or alternatively ...
setValue("Forms!myForm!myControl.Visible", False) ' Shortcut notation' in VBA => Forms!myForm!myControl.Visible = False
Additional documentation: http://www.access2base.com/access2base.html
- Release Description Compatibility Operating Systems License Release notes
Base forms may contain more than 1 data source (NB: MSAccess does not have that feature).
A translation in german is provided (thanks to Gisbert Friege). 5.0 Linux, Windows, macOS LGPL Download
Document, dialog, form, subform and control events can be dynamically got and updated with the new On database, On dialog, On form and On control events properties.
The new module object class and its properties and methods makes it easy to navigate thro 4.0 Linux, Windows, macOS LGPL Download
The CopyObject action may copy tables (structure and data) from one database to another. As an experimental feature involved tables may even reside in different database systems.
The database class has received new properties: Name, Connect and Version.
4.0 Linux, Windows, macOS MPL Download
More complete management of (long) binary fields in databases with the addition of the GetChunk and AppendChunk methods to the field object.<br />
Addition of the Picture property for ImageControl controls. 4.1 MPL Download
The OutputTo action has been significantly enhanced. Output in one single Basic statement the content of a table or of a SELECT query into
- an html file. The data table can be embedded in a template file wontaining styling options
- a Calc spreadsheet
4.1 MPL Download
New CommandBars collection of CommandBar objects:
Easily show/hide menu bar, status bar, toolbars and toolbar elements. 4.0 MPL Download
All the methods which can be used without a database connection (error handling, dialogs manipulations, status bar and window handling, commands launch, ...) are usable as such even from non-Base applications.
To pass values from one open document to ano 4.1 MPL Download
- 1.1.0 The 1.1.0 version allows dynamic data access from any Basic macro, including, just as an example, from a user-defined function invoked in a Calc cell formula. 3.6 MPL The Access2Base library can be run to access a database defined in any form defined in any AOO/LibO document. Now the CurrentDb method may be associated with a form object, not only with the root class. The OpenDatabase method allows any AOO/LibO document or any Basic macro to get access to tables stored in any database. The CopyObject (new) action copies query definitions and/or table definitions and data. Creation of table and fields without SQL with the CreateTableDef, CreateField and Add methods. The new GetRows method loads a given number of records from a recordset in a Basic array. RunSQL, OpenSQL, database functions have been extended to be run from a database object, not only as a command. New GetHiddenAttribute and SetHiddenAttribute actions hide or show any AOO/LibO or Base object. SelectObject scope has been extended accordingly. The Description property of a TableDef is writable. Addition of the SelStart, SelLength and SelText properties for text controls. Download
Inclusion of Access2Base code into the LibreOffice 4.2 build.
Code stabilisation, robustness improvements (naming collisions risks, error handler, ...)
Toggle sidebar in RunCommand
Alignment of code with LibreOffice 4.2 new internal format for Time fie 3.3 MPL Download
Framework for database access:
TableDefs, QueryDefs, Recordsets and Fields collections.
TableDef, QueryDef, Recordset and Field objects.
Addition of the CurrentRecord and Recordset properties for forms and subforms.
Introspection improved with the Ite 3.6 LGPL Download
Performance improvement when processing very large (1000+ items) listboxes.
Workaround implemented to survive the LibreOffice 4.0 bug described in BugZilla (https://www.libreoffice.org/bugzilla/show_bug.cgi?id=60752)
Finalization of the App 3.6 LGPL Download
Complete internal redesign of code to allow more object-oriented syntaxes for property settings and method invocations.
form.height = 100
Old syntax still supported.
Consolidation of the object model with the Parent, S 3.3 LGPL Download
- of the 2 dialogs forms
- of all strings (mainly error messages) used in the API
A french translation is provided.
For other languages, contributions are welcome. 3.3 LGPL Download
- 0.8.6 Maintenance release 3.3 LGPL Download
Introduction of new commands:
OutputTo for storing a form document as a PDF, DOC, ... file.
SendObject to send a form after transformation to PDF, DOC, ... by mail.
RunApp to start an external application. 3.3 LGPL Download
API implementation identical to 0.8.1.
"Check for Updates ..." functionality now detects Access2Base new versions. 3.3 LGPL Download
Bug fixing in the setValue method.
Bug fixing in the setValue method.Download
Full support of standalone (Writer) forms.
Full support of standalone (Writer) forms.
Other minor changes:
RadioButtons order is now determined by their X-Y coordinates on the screen.Download
Bug fixing in checkboxes controls when linked to a database field.
Support of "Currency" datatype in arguments to the API. Useful for controls of currency type. Converted to Double in internal processing.
Support of Listboxes with a separate column for bound fields.
Introduction of the Bookmark property of Form pseudo-objects.
New actions: ShowAllRecords and GoToControl.
New methods for managing Listboxes content (with the ValueList rowsource type): Add 3.3 LGPL Download
- 0.7.1 Correction of URL of online help. Clickable from Help menu in the Basic IDE. 3.3 LGPL Download
Bugs fixing in the SelectObject action (abort when help file open).
Extension of the scope of the SelectObject action.
Introduction of the RunCommand action. Documentation updated. 3.3 LGPL Download
- 0.6.0 New actions: Maximize, Minimize, etc. 3.3 LGPL Download
- 0.5.1 Minor changes vs. version 0.5.0 3.3 LGPL Download
- 0.5.0 First public release 3.3 LGPL Download