Hello All, I am hoping this is an easy question but I tried some examples off google and didn't have much luck. I want to have multiple forms point to one form called "InsertItemF". Let's call one the these forms SourceFormF. InsertItemF populates a listbox from a variety of tables based on specific parameters. It concatenates a string that is inserted into the SourceFormF.
The code that opens InsertItemF from SourceFormF also populates two fields, SourceForm and SourceField on InsertItemF (these are referenced in the code below)
Code:
Private Sub InsertItem()
Dim SrcFrm As Form
Dim SrcFld As String
Set SrcFrm = Forms(Me.SourceForm)
SrcFld = Me.SourceField
Forms!SrcFrm!SrcFld = " nz(Dsum('[MMYYYY " & Me.CalcTypeCombo.Column(1) & "]', '[" & Me.TableCombo & "]', 'ID = " & Me.LineItemList.Column(0) & "'),0)"
End Sub
And here's a visual (red circle is the button on SourceF that opens InsertItemF, blue circle is the form/field names that were inserted by the red circled button. In this example it should be SourceF instead of Iif):