Trouble installing Access2base

I’m trying to install and learn to use the Access2base macro library. But I’m getting a fatal error message after installing. What am I missing?

Also could you help me understand how to read the error message given, as I think I’m likely to see other similar error messages. It reads in part, Argument nr. 1 [Value = '[EMPTY]'] is invalid.

I’m guessing that means Argument number 1 or the first argument of the function called. Not sure if it’s talking about DBOpen or OpenDocument?. And it appears that the first function parameter is missing, which is invalid.


Installing: The Access2base install instructions are at the Access2base web site, and I would give you a specific page URL, but you can’t use normal page URLs for their web site which appears to be JavaScript driven, and thus a non standard html interface.

  • To see the installation instructions click on Getting Started in the top of the left column. (BTW, if you click the wrong page, you can’t backup normally. What you can do is scroll to the top of a page and close the unwanted yellow or brown tab which effectively backs you up to your last screen.)

  • Now scroll down to Start using the library.

The instructions there appear to be either unclear or incorrect. Here’s what I did, and the error I am getting:


A) Create Access2base library to hold the sub they want installed:

A) 1of3

A) 2of3

A) 3of3


B) Install DBOpen as an OpenConnection event:

B) 1of2

B) 2of2


RESULT: Close and reopen gives a FATAL error

FATAL Error #1503 (Argument nr. 1 [Value = ‘[EMPTY]’] is invalid) occured in a call to function ‘OpenConnection’

image description


LO 5.2.2.2 on Debian Jessie

There is nothing to install to use Access2Base as it comes with it. You do, however, need to load the library to use it. Usually the best example is a working document. Posted one today on this answer - click here.

Don’t really use Access2Base as it is added overhead.

Edit: About your error - it appears it may be because you are using a name already in use. The Access2Base library is already under LibreOffice Macros & Dialogs.

Thanks the working document example helped me sort it out. The main problem turned out to be that I needed to be putting my open and close inside the HSQLDB test1.odb | Standard | (the specific database name that I was working on), not inside “My Macros | Standard”. (Still not sure if “Access2Base” was overloaded. I’ll try to update this if I figure that out.)

  1. You should not install anything.
  2. Remove your Access2Base library from “My macros and Dialogs”.
  3. Store the DBOpen routine in a module of the Standard library of the Base document. Otherwise the argument ThisDatabaseDocument in the call to OpenConnection() is empty, what is expressed in the error message.

BTW the Install age URL in the Access2Base documentation is Access2Base - It's about converting PEOPLE, not data
(Right click on “Bookmark this link” and copy location at the bottom of any page).

JPL

It seems in the Basic editor dialog’s left pane it’s called, “My Macros & Dialogs”, but in the Select Macro or Select Module dialogs it’s called “My Macros”.

It seems in the Basic editor dialog’s left pane it’s called, “My Macros & Dialogs”, but in the Select Macro or Select Module dialogs it’s called just “My Macros”.

The Access2Base project was set up to help those with experience of VBA code in MS Access to make the transition to LO Base. The library emulates VBA commands in LO Basic.

The Access2Base Library is provided in versions of LO 4.2 and later. If you have installed the Assess2Base extension then remove it.

It states in the tutorial -
Open in the main AOO/LibO Base window the “.odb” file (the database document) on which you would like to apply Access2Base functions.
With Tools + Macros + Organize Macros + OpenOffice/LibreOffice Basic… open the Basic IDE and create a Basic module in the Standard library of the database document itself. The module should contain as a minimum next code:

Sub DBOpen(Optional poEvent As Object)
	If GlobalScope.BasicLibraries.hasByName("Access2Base") then
		GlobalScope.BasicLibraries.loadLibrary("Access2Base")
	End If
	Call Application.OpenConnection(ThisDatabaseDocument)
End Sub

So you should create the Module in your database file not in My Macros as you have.

Have you tried the excellent sample provided by @Ratslinger in your other posting.

It is probably a good idea to learn in the long term to program in the Basic provided by LO. It you look at the Access2Base Library you can see how VBA commands are translated into LO Basic.

I think I might have confused you a bit. Sorry. The “Access2Base” that I had referred to was where I had my open and close code. It was not the Access2Base library. I now see that this was a poor choice of names on my part. Once I moved the DBOpen and DBClose this fixed this issue. Thanks for the help.

@EasyTrieve - Just a comment - I prefer to use View is going to be closed in most cases because Document is going to be closed causes other problems in what I do.

To recap, put your DBOpen & DBClose in:

<your current database's library container name> / library / module` 

as shown below, rather than in

My Macros (library container) / Standard (library) / <module name > (module)

Also, I suspect that DBClose should be hooked to the

Document is going to be closed event

not

View is going to be closed

as is suggested in [the install instructions(Access2Base - It's about converting PEOPLE, not data), as shown below:

@EasyTrieve It is probably not a good idea to name the Module created in the Standard Module of your document “Access2Base” as there could be a conflict with the the module containing the Access2Base routines. Just module1 is what I would use.