Ask Your Question

Basic runtime error: property or method not found: last.

asked 2016-10-30 07:22:56 +0100

lobito gravatar image

I'm just trying to write my first few macros in LO Base and always run into the same problem: Basic runtime error: property or method not found: last. or Basic runtime error: property or method not found: absolute. or Basic runtime error: property or method not found: drawpage.

All these methods are descripted in the Base handbook.

Do I have to install some addtional library or something or what else might be the problem?

Code snippet: ... Dim loLastRow AS LONG oForm = oEvent.source IF oForm.last THEN loLastRow = oForm.getRow ELSE loLastRow = 0 END IF ...

Thanks in advance for your help!

edit retag flag offensive close merge delete


Based upon your snippet the problem cannot be determined. This is because it is unknown what is assigned to the variable oForm. Typically oEvent.Source is a field and not the parent form. Please provide more information on what you are attempting to accomplish with the code. An entire sub you are having a problem with would be best.

Ratslinger gravatar imageRatslinger ( 2016-10-30 15:24:35 +0100 )edit

3 Answers

Sort by » oldest newest most voted

answered 2016-10-30 17:09:41 +0100

peterwt gravatar image

updated 2016-10-31 12:55:36 +0100

There are two useful commands that you can include in a macro -


So for a Form oForm using


you will get in a mesage box -

Properties of object 
SbxSTRING ActiveCommand; SbxOBJECT/void ActiveConnection; SbxBOOL AllowDeletes; 
SbxBOOL AllowInserts; SbxBOOL AllowUpdates; SbxBOOL ApplyFilter; 
SbxBOOL CanUpdateInsertedRows; SbxSTRING Command; SbxLONG CommandType; 
SbxLONG/void ControlBorderColorOnFocus; SbxLONG/void ControlBorderColorOnHover; SbxLONG/void ControlBorderColorOnInvalid; 
SbxLONG/void Cycle; SbxSTRING DataSourceName; SbxARRAY DetailFields; 
SbxBOOL/void DynamicControlBorder; SbxBOOL EscapeProcessing; SbxLONG FetchDirection; 
SbxLONG FetchSize; SbxSTRING Filter; SbxSTRING GroupBy; 
SbxSTRING HavingClause; SbxBOOL IgnoreResult; SbxBOOL IsBookmarkable; 
SbxBOOL IsModified; SbxBOOL IsNew; SbxBOOL IsRowCountFinal; 
SbxARRAY MasterFields; SbxLONG MaxFieldSize; SbxLONG MaxRows; 
SbxSTRING Name; SbxLONG NavigationBarMode; SbxSTRING Order; 
SbxSTRING Password; SbxLONG Privileges; SbxBOOL PropertyChangeNotificationEnabled; 
SbxLONG QueryTimeOut; SbxLONG ResultSetConcurrency; SbxLONG ResultSetType; 
SbxLONG RowCount; SbxOBJECT SingleSelectQueryComposer; SbxLONG SubmitEncoding; 
SbxLONG SubmitMethod; SbxSTRING TargetFrame; SbxSTRING TargetURL; 
SbxLONG TransactionIsolation; SbxOBJECT/void TypeMap; SbxSTRING URL; 
SbxSTRING UpdateCatalogName; SbxSTRING UpdateSchemaName; SbxSTRING UpdateTableName; 
SbxSTRING User; SbxOBJECT PropertySetInfo; SbxOBJECT Parameters; 
SbxEMPTY Warnings; SbxARRAY Types; SbxARRAY ImplementationId; 
SbxOBJECT Delegator; SbxEMPTY Bookmark; SbxOBJECT MetaData; 
SbxOBJECT Columns; SbxSTRING ImplementationName; SbxARRAY SupportedServiceNames; 
SbxLONG Row; SbxOBJECT Statement; SbxSTRING PropertyToDefault; 
SbxOBJECT Parent; SbxBOOL GroupControl; SbxARRAY ControlModels; 
SbxLONG GroupCount; SbxOBJECT ElementType; SbxARRAY ElementNames; 
SbxLONG Count; SbxSTRING ServiceName; SbxARRAY PropertyValues; 
SbxSTRING Dbg_SupportedInterfaces; SbxSTRING Dbg_Properties; SbxSTRING Dbg_Methods

and the methods -

Methods of object 
SbxEMPTY queryInterface ( SbxOBJECT ) ; SbxOBJECT getPropertySetInfo ( void ) ; SbxVOID setPropertyValue ( SbxSTRING, SbxVARIANT ) ; SbxEMPTY getPropertyValue ( SbxSTRING ) ; SbxVOID addPropertyChangeListener ( SbxSTRING, SbxOBJECT ) ; SbxVOID removePropertyChangeListener ( SbxSTRING, SbxOBJECT ) ; SbxVOID addVetoableChangeListener ( SbxSTRING, SbxOBJECT ) ; SbxVOID removeVetoableChangeListener ( SbxSTRING, SbxOBJECT ) ; 
SbxVOID setFastPropertyValue ( SbxLONG, SbxVARIANT ) ; SbxEMPTY getFastPropertyValue ( SbxLONG ) ; SbxOBJECT getPropertySetInfo ( void ) ; SbxVOID setPropertyValues ( SbxARRAY, SbxARRAY ) ; SbxARRAY getPropertyValues ( SbxARRAY ) ; SbxVOID addPropertiesChangeListener ( SbxARRAY, SbxOBJECT ) ; SbxVOID removePropertiesChangeListener ( SbxOBJECT ) ; SbxVOID firePropertiesChangeEvent ( SbxARRAY, SbxOBJECT ) ; 
SbxOBJECT createResultSet ( void ) ; SbxVOID addRowSetApproveListener ( SbxOBJECT ) ; SbxVOID removeRowSetApproveListener ( SbxOBJECT ) ; SbxVOID addRowsChangeListener ( SbxOBJECT ) ; SbxVOID removeRowsChangeListener ( SbxOBJECT ) ; SbxARRAY deleteRows ( SbxARRAY ) ; SbxVOID setNull ( SbxLONG, SbxLONG ) ; SbxVOID setObjectNull ( SbxLONG, SbxLONG, SbxSTRING ) ; 
SbxVOID setBoolean ( SbxLONG, SbxBOOL ) ; SbxVOID setByte ( SbxLONG, SbxINTEGER ) ; SbxVOID setShort ( SbxLONG, SbxINTEGER ) ; SbxVOID setInt ( SbxLONG, SbxLONG ) ; SbxVOID setLong ( SbxLONG, SbxINT64 ) ; SbxVOID setFloat ( SbxLONG, SbxSINGLE ) ; SbxVOID setDouble ( SbxLONG, SbxDOUBLE ) ; SbxVOID setString ( SbxLONG, SbxSTRING ) ; 
SbxVOID setBytes ( SbxLONG, SbxARRAY ) ; SbxVOID setDate ( SbxLONG, SbxOBJECT ) ; SbxVOID setTime ( SbxLONG, SbxOBJECT ) ; SbxVOID setTimestamp ( SbxLONG, SbxOBJECT ) ; SbxVOID setBinaryStream ( SbxLONG, SbxOBJECT, SbxLONG ) ; SbxVOID setCharacterStream ( SbxLONG, SbxOBJECT, SbxLONG ) ; SbxVOID setObject ( SbxLONG, SbxVARIANT ) ; SbxVOID setObjectWithInfo ( SbxLONG, SbxVARIANT, SbxLONG, SbxLONG ) ; 
SbxVOID setRef ( SbxLONG, SbxOBJECT ) ; SbxVOID setBlob ( SbxLONG, SbxOBJECT ) ; SbxVOID setClob ( SbxLONG, SbxOBJECT ) ; SbxVOID setArray ( SbxLONG, SbxOBJECT ) ; SbxVOID clearParameters ( void ) ; SbxVOID disposing ( SbxOBJECT ) ; SbxVOID insertRow ( void ) ; SbxVOID updateRow ( void ) ; 
SbxVOID deleteRow ( void ) ; SbxVOID cancelRowUpdates ( void ) ; SbxVOID moveToInsertRow ( void ) ; SbxVOID moveToCurrentRow ( void ) ; SbxVOID updateNull ( SbxLONG ) ; SbxVOID updateBoolean ( SbxLONG, SbxBOOL ) ; SbxVOID updateByte ( SbxLONG, SbxINTEGER ) ; SbxVOID updateShort ( SbxLONG, SbxINTEGER ) ; 
SbxVOID updateInt ( SbxLONG, SbxLONG ) ; SbxVOID updateLong ( SbxLONG, SbxINT64 ) ; SbxVOID updateFloat ( SbxLONG, SbxSINGLE ) ; SbxVOID updateDouble ( SbxLONG, SbxDOUBLE ) ; SbxVOID updateString ( SbxLONG, SbxSTRING ) ; SbxVOID updateBytes ( SbxLONG, SbxARRAY ) ; SbxVOID updateDate ( SbxLONG, SbxOBJECT ) ; SbxVOID updateTime ( SbxLONG, SbxOBJECT ) ; 
SbxVOID updateTimestamp ( SbxLONG, SbxOBJECT ) ; SbxVOID updateBinaryStream ( SbxLONG, SbxOBJECT, SbxLONG ) ; SbxVOID updateCharacterStream ( SbxLONG, SbxOBJECT, SbxLONG ) ; SbxVOID updateObject ( SbxLONG, SbxVARIANT ) ; SbxVOID updateNumericObject ( SbxLONG, SbxVARIANT, SbxLONG ) ; SbxVOID cancel ( void ) ; SbxVOID executeWithCompletion ( SbxOBJECT ) ; SbxOBJECT getParameters ( void ) ; 
SbxEMPTY getWarnings ( void ) ; SbxVOID clearWarnings ( void ) ; SbxARRAY getTypes ( void ) ; SbxARRAY getImplementationId ( void ) ; SbxOBJECT queryAdapter ...
edit flag offensive delete link more


Very helpful. Thank you.

EasyTrieve gravatar imageEasyTrieve ( 2016-11-04 23:27:34 +0100 )edit

answered 2016-10-30 21:06:52 +0100

Ratslinger gravatar image

updated 2016-11-02 08:30:11 +0100

OK. After going through some of the document you referred to I sense some of your anguish. Starting to code macros is at times frustrating. In order to help start you out I have attached a sample DB. It contains one table with three records and four fields within each record.

There are two forms. Form FSFORM1 has a table control displaying the contents of FSTABLE1. It has a simple macro attached to the Record Change event and displays (using a MsgBox) the contents of the currently pointed to record. If the last record is selected, you will additionally get a display of the total number of records in the table.

Form FSFORM2SQL has only a push button on it. The form itself is attached to table FSTABLE1. The button triggers a macro to read the records in the table using SQL and displays the contents of each record. On the last record you also get a count of the total number of records in the table.

The macros have some comments within to help walk you through. Hopefully this help get you started. It's not easy at first but be persistent.

Edit 10/31/2016:

Modified code per @peterwt comment. Also added Option Explicit and some missing Dim statements.

Sample: FirstMacros.odb

Edit 11/02/2016:

Place a button on the form and attach the following macro to the Execute action event.

Sub RgNr_kopieren (oEvent AS OBJECT)
REM copy RgNr from the first row to all others
 Dim oForm AS OBJECT
 Dim inRgNr AS LONG
 Dim loRecPtr As Long
 oForm = oEvent.Source.Model.Parent
REM loRecPtr used to get records - initially set it to get first record
 loRecPtr = 1
 inRgNr = oForm.getLong(10)
Rem Loop through records
 While Not oForm.isLast()
Rem increment Pointer to record by one (to get next record)
    loRecPtr = loRecPtr + 1
Rem must use oForm. in next two lines - this is in the book! 
 MsgBox "Update Completed"
 End Sub
edit flag offensive delete link more


@Ratslinger I have edited my original posting with a comment on your sample database.

peterwt gravatar imagepeterwt ( 2016-10-31 12:57:58 +0100 )edit

@Ratslinger Thanks for all your efforts! But I still cannot find out what's wrong. Here is the whole sub: Sub RgNr_kopieren (oEvent AS OBJECT) REM copy RgNr from the first row to all others Dim oForm AS OBJECT Dim inRgNr AS LONG Dim loRow AS LONG Dim loLastRow AS LONG oForm = oEvent.source IF oForm.last THEN loLastRow = oForm.getRow ELSE loLastRow = 0 END IF oForm.absolute(1) inRgNr = oForm.getLong(10) FOR loRow = 2 to 3 oForm.absolute(loRow) updateLong(10,inRgNr) updateRow() NEXT loRow End S

lobito gravatar imagelobito ( 2016-11-01 20:23:21 +0100 )edit

What control is generating the Event?

See new edit in my answer.

If this answers your question please click on the ✔ (upper left area of answer).

Ratslinger gravatar imageRatslinger ( 2016-11-02 06:48:20 +0100 )edit

answered 2016-11-02 11:38:14 +0100

lobito gravatar image

updated 2016-11-02 11:41:56 +0100

@Ratslinger The event is generated by a control button in the main form. So the hint of @peterwt was what really solved the problem: using oForm = oEvent.Source.Model.Parent instead of only oForm = oEvent.Source. Your code with the while - loop is more elegant than mine, so I'll use that. Thank you very much! @peterwt Thank you as well for all your efforts! I learned quite a lot from this expamle besinde the fact that the problem is solved.

If you attempt to run the code from Macros - Run macro it will fail as there will be no oEvent argument.

This is a good hint. I'm just at the beginning but once my macro library has grown a bit I'll consider that.

The source of the event being the Button and the Form is the parent of the Button.

I'm just wondering why I couldn't find something that important in the base handbook ...

edit flag offensive delete link more



@lobito There is a lot of information here

OpenOffice Macrosorg Explained.pdf.

peterwt gravatar imagepeterwt ( 2016-11-02 12:33:17 +0100 )edit

@lobito make sure you compare the code to yours. Some of your code did nothing and other code was missing parts such as oForm. The "While" statement simply insures you get all the records. It wasn't just the creation of oForm.

Ratslinger gravatar imageRatslinger ( 2016-11-02 15:35:16 +0100 )edit

@lobito, Next time please update (i.e. edit) your original question with your response (to a question in a comment), rather than adding an "Answer" which is what you did here. This is not a forum, but rather a question and answer structured site. Thanks.

EasyTrieve gravatar imageEasyTrieve ( 2016-11-04 23:20:38 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-10-30 07:22:56 +0100

Seen: 823 times

Last updated: Nov 02 '16