Access2Base
什么是 Access2Base?
Access2Base 是一个 LibreOffice Basic 宏的程序库,用于商业和个人程序开发者以及高级用户。它是存储在 "LibreOffice 宏和对话框" 中的程序库之一。
这些宏中提供的功能都是直接受微软 Access 的启发而实施的。这些宏主要运行于 LibreOffice Base 程序中,但是,如果有必要调用储存在数据库中的数据,当然也可以在任何其他 LibreOffice 文档 (Writer, Calc, ...) 中运行。
比起标准的UNO API,Access2Base 提供的 API 旨在尽可能的简单、直观、容易学习。

该程序库的用户文档可在以下位置找到:http://www.access2base.com。
实现的宏包括:
-
它是一个简化并可扩展的API,用于对 表单、对话框以及控件进行操作,与Microsoft Access 对象模型类似。
-
an API for database access with the table, query, recordset and field objects,
-
a number of actions with a syntax identical to their corresponding Microsoft Access macros/actions,
-
the DLookup, DSum, ... database functions,
-
支持类似 Forms!myForm!myControl 的快捷符号(shortcut notations)
in addition
-
a consistent errors and exceptions handler,
-
facilities for programming form, dialog and control events and
-
the support of both embedded forms and standalone (Writer) forms.
Access2Base 与 Microsoft Access VBA 的对比
REM Open a form ...
OpenForm("myForm")
REM Move a form to new left-top coordinates ...
Dim ofForm As Object ' In VBA => Dim ofForm As Form
Set ofForm = Forms("myForm")
ofForm.Move(100, 200)
REM Get the value of a control ...
Dim ocControl As Object
ocControl = ofForm.Controls("myControl")
MsgBox ocControl.Value
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