I am trying to use a macro to specify an SQL for a listbox in a subform. The macro is attached to a listbox in the main form for the “item status changed” event.
Here is the macro:
oForm = ThisComponent.getDrawPage().getForms().getByName("FormSalesOrder")
oControl1 = oForm.getByName("buyer name")
buyerid = oControl1.getCurrentValue()
sSql = "SELECT ""buyerpartname"", ""buyerpartid"" FROM ""buyerpartno"" WHERE ""buyerid""='"& buyerid &"'"
oSubForm = oForm.getByName("FormSalesOrderItem")
oColumns = oSubForm.getColumns()
oField = oColumns.getByName("buyerpartid")
oField.ListSource = array(sSql)
When I change the selected item in the listbox in the main form, it gives me the BASIC runtime error, saying “Property or method not found: ListSource.”
Any help would be much appreciated.