The following code is called from a button on a pop-up form. There may be any one of several identical forms (whose only difference is data source) behind it when the popup closes (via DoneButton). Obviously I need to avoid referring to the underlying form name explicitly. This code does not work(I've bolded the problem), but I've got to be close to the answer. A little help please?!
Private Sub DoneButton_Click()
DoCmd.Close
Dim frmCurrentForm As Form
Dim ctlList As Control
Set frmCurrentForm = Screen.ActiveForm
' Return Control object pointing to list box.
Set ctlList = Forms!frmCurrentForm!contractorfield
' Requery source of data for list box.
ctlList.Requery
End Sub
Thanks.
Jay
Private Sub DoneButton_Click()
DoCmd.Close
Dim frmCurrentForm As Form
Dim ctlList As Control
Set frmCurrentForm = Screen.ActiveForm
' Return Control object pointing to list box.
Set ctlList = Forms!frmCurrentForm!contractorfield
' Requery source of data for list box.
ctlList.Requery
End Sub
Thanks.
Jay