Bug 50599 - Macros: NoSuchElementException during normal work on new record
Summary: Macros: NoSuchElementException during normal work on new record
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Win-Installer-MAB
  Show dependency treegraph
 
Reported: 2012-06-01 15:14 UTC by Mateusz
Modified: 2013-02-04 17:52 UTC (History)
0 users

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz 2012-06-01 15:14:33 UTC
I have this problem when:
1. On Form I have two forms, each attached to the different table
2. I am inserting new row in sub-form, by editing list boxes, and date list boxes.
NOTE: The subform is joined to the main table by master - slave field.
3. When I click on the drop-down button on date list box (one field in my table stores date), this exception occures:

Type: com.sun.star.container.NoSuchElementException

And I have no macro, just editing NewRow in my table.
To get this exception caught I had to add a macro to the "Before Record Action" event (see below).
The problem is that I simply click on the date control. Or sometimes double-click the form (not any specific control) - and the whole LibreOffice crashes and the I had to recover the file.


Function prevent_saving_uncompleted_record (oEvent As Object)
REM When clicking on the Form during record modification/creation, Libre Office unexpectedly attempts to save uncompleted record
REM Because of that this function is set on the "Before record action" event to prevent saving a record during modifications.
	REM Set up error handler
	On error GoTo ErrorHandler

	REM By default all modifications to the row are not allowed
	prevent_saving_uncompleted_record = True
Dim oForm As Object
Dim oControl As Object
	oForm = oEvent.Source.Model
	oControl = oForm.GetByName("Save button")
	REM Check if "Save button" is enabled (it is enabled when any of the field has changed)
	If oControl.Enabled = "True" Then
		prevent_saving_uncompleted_record = False
	End If
	Exit Function
	
	ErrorHandler:
	MsgBox "Error " & err & ": " & error$ + chr(13) + "In line : " + Erl + chr(13) + Now , 16 ,"An error occurred"
End Function
Comment 1 Mateusz 2012-06-07 01:01:48 UTC
It was my fault. Still learning ... :)
Crash will be logged into separate issue. Here I had a wrong control name.