Stuart McLachlan
stuart at lexacorp.com.pg
Tue Apr 29 00:48:32 CDT 2003
On 28 Apr 2003 at 23:59, John Bartow wrote: > Right now the popup form is duplicated 4 times, each one is only used by one > main form and each main form only calls one of the popups. The calling form > is hardcoded in each specific popup form's code and that is how the return > values are put into the main form that called it. > > This form is going to get reused again and again and I would like to > eliminate that maintenance overhead. I am burnt out at the moment and would > like some advice on how to handle changing these main forms to call one > popup form but still be able to update the 7 items on the main form that > called it. > Pass the name of the calling form in OpenArgs when you open the popup and use that to set the values. Here's the bare bones which just updates one text box In your main form's popup calling event: Private Sub cmdOpenPopup_Click() DoCmd.OpenForm "frmPopup", , , , , , Me.Name End Sub ........ In your Popup form: Private strCallingForm As String Private Sub Form_Open(Cancel As Integer) strCallingForm = OpenArgs End Sub Private Sub CmdUpdateCallingForm_Click() Forms(strCallingForm).txtMyInfo = "Updated" DoCmd.Close End Sub -- Stuart McLachlan Lexacorp Ltd Application Development, IT Consultancy http://www.lexacorp.com.pg