Form Close ?

  • Thread starter Thread starter Michelle
  • Start date Start date
M

Michelle

I have a form "frmLocation" the form has a list box so the user can select
the location to run a query "qurEquipLocation" that is used to produce a
report "rptEquipLocation"
I have it set up so frmLocation opens you select the location and then click
OK when you click OK it opens frmEquipLocation in print preview...this all
works great.
Now what I would like to happen is once the report is open it closes the
frmLocation.
Here is the code I have and it does not do what I want.

I have tried this code on the OK button....

Private Sub cmdOK_Click()
DoCmd.OpenReport "rptEquipLocation", acViewPreview, "qurEquipLocation"
DoCmd.Close acFrom, "frmLocation"
End Sub

And I have have tried this code in the report in the On Open Event

Private Sub Report_Open(Cancel As Integer)
DoCmd.Close acFrom, "frmLocation", acSaveNo
End Sub

I am sure I am just missing one little thing...also if it makes any
difference frmLocation is a popup
 
Hi Michelle,
If the code you posted is a verbatim copy of the code you tried to execute
you're missing nothing, 'cause is just a typo:
to identify a form in the close method it's not acFrom but acForm

HTH Paolo
 
You have used acfROm instead of acfORm in both cases.
Presumably you are squashing errors, or Access would be reporting a problem
here.

It might be better to use the Close event of the report if the report's
query actually tries to do something with the form.
 
Back
Top