Hi, I have found a macro that seems to do exactly what i want it to do in an example database. I tried to copy, paste and edit to suit my requirements. The macro does not seem to run when called for. The macro also has references to source.model.parent. The macro is embedded and is shown below, how can I use this in my database?
Sub Refresh_MainForm (oEvent As Object) 'List Box > Execute (event)
oForm = oEvent.Source.Model.Parent 'MainForm
oEvent.Source.Model.commit() 'commits the selected List Box value to the Form only
' IF oForm.isnew THEN oForm.insertRow() ELSE oForm.updateRow() 'handles both cases to avoid errors
oForm.updateRow() 'commits the List Box Bounfield; only oForm.updateRow() is required in this case due to Form filter criteria ID=0
' oForm.reload 'updates the SubForm link(s) as necessary to complete the Form 'refresh'
oForm.getByName("SubForm1").getByName("listboxClass").refresh 'necessary to update the List Box filter (listboxClass") on SubForm1
oForm.reload 'updates the SubForm link(s) as necessary to complete the Form 'refresh'
End Sub
Sub Refresh_SubForm1 (oEvent As Object) 'List Box > Execute (event)
oForm = oEvent.Source.Model.Parent
oEvent.Source.Model.commit()
oForm.updateRow() 'MainForm current record update
oForm.reload
End Sub
(Slightly edited for readability by @Lupp )