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

asked 2014-04-24 01:16:03 +0200

kmihalj gravatar image

updated 2014-04-24 01:17:06 +0200

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
    oForm2 = ThisDatabaseDocument.FormDocuments.getByName("Upisni") 
    oForm3 = oForm2.Component.DrawPage.Forms.getByName("Upisni_List")
    oForm3.Filter="( ""UPISNI_LIST"".""FK_Maticni"" = " & iID & " )" 
end sub

Sub Refresh_MainForm (oEvent As Object) 'List Box > Execute (event)
   oForm = oEvent.Source.Model.Parent 
   oForm.updateRow() 'this is point where I get error when entering data to new record via listbox, ... changing data on existing records works fine
End Sub
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2016-02-21 07:19:58.050175