Form Close ?

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
 
P

Paolo

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
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top