Hello everybody, I have a subform with table-control in which I need to filter data depending on what is displayed in textbox in main form (text is not entered but only browsed by navigation bar). I can not use form-subform relation because in that case slave field is '=' master field, and I need it to be LIKE. I tried to modify macro (putting the name of the sub form instead of "MainForm") that is used to filter data in table-control when control TextBox is a part of the same form but without success. Here is the macro that should be changed
Code: Select all
Sub Search_by_name
dim oFilter as object
dim oFormCtl as object
oFormCtl = ThisComponent.Drawpage.Forms.getByName("MainForm")
oFilter = oFormCtl.getByName("TextBox")
if oFilter.Text <> "" then
oFormCtl.Filter = "Name LIKE " + "'%"+oFilter.Text+"%'"
oFormCtl.ApplyFilter = True
else
oFormCtl.ApplyFilter = False
end if
oFormCtl.Reload
End Sub
I know that it is probably trivial and I recall seeing it in once but could not find it.