filter database database forms Tom Schindl How do I access a SubSubForm and set an filter

I have a form document to view a datasource. The document has a form, a subform, and a sub-subform, all of them linked with one-to-many relationship. I need to filter the last subform on the fly, pushing a button. I need to write a StarBasic macro that can do that on the fly, without switching to design mode. Is this possible?

Yes given the sturcture looks like the following

+ Form1

+ Form1_1

+ Form1_1_1

Sub setFilter ' reserve some variables Dim TopForm As Object Dim SubForm As Object Dim SubSubForm As Object ' Fetch the appropiate form TopForm = ThisComponent.DrawPage.Forms.GetByName("Form1") SubForm = TopForm.GetByName("Form1_1") SubSubForm = SubForm.GetByName("Form1_1_1") ' Now we set the filter attribute SubSubForm.Filter = "p_surname LIKE 'Sch%'" ' and don't forget to reload SubSubForm.reload() End Sub
Initial version