# Macro to open another form with selected data, or to create new data if "filtered" if not existing ... [closed]

I use macros from example in this post from file Open_Form_Filtered.odb, .... but...

What if I don't have filtered record in other form (no relation data created) .... I need macro to open filtered data in another form or to create new record if data is not existend ... well I can add data to opened form, but trouble is listbox in which if I select data (for new record) I get error, and nothing is entered (unless I disable macro for listbox)

So in short, error in on new record in listbox ...

Now I use this...

Sub Otvori_Upisni_List_iz_Maticnog_Lista (oEvent As Object) 'This opens another form with filtered data
oForm = oEvent.Source.Model.Parent
iID=oForm.getByName("ID_Maticni").text
oForm2 = ThisDatabaseDocument.FormDocuments.getByName("Upisni")
oForm2.Open
oForm3 = oForm2.Component.DrawPage.Forms.getByName("Upisni_List")
oForm3.Filter="( ""UPISNI_LIST"".""FK_Maticni"" = " & iID & " )"
oForm3.ApplyFilter=True