RichardOneil
MIS
Hi-
I have created an Access form that shows summary level detail and when you click on a record a new form opens that has the detail information. My problem is that the main form is not closing like I want it to:
Line 1 opens the detail form. Line 2 populates a text box on the new form with the description of the record the user selected on the main form. The third line sets the focus back on the main form. The fourth line should close the main form but it doesn't work and I can't figure out why. This is purely cosmetic and the program will work without it, but I would like to understand why it doesn't work in this instance. I thought about setting up a close macro and calling that with DoCmd.RunMacro, but before I resort to that, I'd like to try something a bit more elegant. Thanks in advance for your help.
I have created an Access form that shows summary level detail and when you click on a record a new form opens that has the detail information. My problem is that the main form is not closing like I want it to:
Code:
[COLOR=blue]Application.DoCmd.OpenForm "frmDetail", acNormal
Form_frmDetail.txtRptName.Value = RptName
Form_frmMain.SetFocus
Application.DoCmd.Close acForm, "Form_frmMain", acSaveNo[/color]
Line 1 opens the detail form. Line 2 populates a text box on the new form with the description of the record the user selected on the main form. The third line sets the focus back on the main form. The fourth line should close the main form but it doesn't work and I can't figure out why. This is purely cosmetic and the program will work without it, but I would like to understand why it doesn't work in this instance. I thought about setting up a close macro and calling that with DoCmd.RunMacro, but before I resort to that, I'd like to try something a bit more elegant. Thanks in advance for your help.