geophotog

How do I pass a form to a function?

Discussion created by geophotog on Mar 31, 2011
Latest reply on Apr 1, 2011 by ecohydrologist
How do I pass a form to a function?

Since I have multiple forms which each contain a combo box listing the same Editor names, I am trying to programmatically pass each form (at initialization) to a function which populates the Editor Names combo box with the desired values (from a standalone table). My code is below:


Private Sub UserForm_Initialize()[INDENT]PopulateEditorNameComboBox(thisForm) 'Call function from form[/INDENT]End Sub


Public Function PopulateEditorNameComboBox(passedForm as <?>)
[INDENT]For i = 1 to EditorNameCollection.Count
[INDENT]passedForm.cboEditor.AddItem (EditorNameCollection.item(i)) 'Add item to combo box on indicated form[/INDENT]
Next i[/INDENT]
End Function


Thanks, Jill USFS Region 6

Outcomes