目录
索引 🔎︎

# Access2Base

## 什么是 Access2Base?

Access2Base is a LibreOffice BASIC library of macros for (business or personal) application developers and advanced users. It is one of the libraries stored in "Application macros and dialogs".

The functionalities provided by the implemented macros are all directly inspired by Microsoft Access. The macros are callable mainly from a LibreOffice Base application, but also from any LibreOffice document (Writer, Calc, ...) where access to data stored in a database makes sense.

比起标准的UNO API，Access2Base 提供的 API 旨在尽可能的简单、直观、容易学习。

「该程序库的用户文档可在以下位置找到」:http://www.access2base.com。

## 实现的宏包括:

1. 它是一个简化并可扩展的API，用于对「表单」「对话框」以及「控件」进行操作，与Microsoft Access 对象模型类似。

2. 用于数据库访问的API，包含「表格」「查询」「记录集」和「字段」对象，

3. 一些「动作」，其语法与相应的 Microsoft Access 宏/动作相同，

4. DLookup, DSum, ... 等数据库函数，

5. 支持类似「表单!我的表单!我的控件」的快捷表示法

此外

6. 一致性错误和异常处理，

7. 用于编程表单、对话框以及控件「事件」的工具，以及

8. 对嵌入式表单和独立 (Writer) 表单的支持。

## 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