I have a subform that links to an “ID” value from it’s parent form. The subform has a push button that activates a macro, which reads the “ID” from the linked field, and passes it to an SQL command.
iValue = oForm.Columns.getByName("ID").Value
It can occur that the “ID” value is NULL (they are are selected by a query). This causes an error in the macro:
I’d like to avoid this by error checking, but I cannot find the relevant code in the LibreOffice Base Guide.
I’ve discovered that adding a field “fixes” the problem. The code below:
iValue = oForm.getByName("IDField").getCurrentValue()
returns ‘0’ in the case of NULL, and I can always check for that.
However I feel like this solution may not be robust against future updates, or when changing OS.