How do I close a subform on a report?

K

Kari

Hi All!

I have a report with a subform. There is a command button on the report to
close it, but every time it is clicked Access askes if I want to save the
subform. How do I get rid of this annoying popup?

I think the problem stems from the "sub" being a subform, not a subreport (I
have similar reports with subreports that close just fine). I need it to be
a form so I can show it in datasheet view.

If I use the "x" button to close the report I am asked if I want to save the
report and the subreport. Code on the command button is:

DoCmd.Close acReport, "PO Report", acSaveNo

I have tried explicitly closing the subform (DoCmd.Close acReport,
"Reports![PO Report]![PO Order Details subform for PO Report].Form",
acSaveNo), or saving it first (DoCmd.Save acReport, "Reports![PO Report]![PO
Order Details subform for PO Report].Form" ), all from the command button.
Closing doesn't do anything, and saving generates an error ("Object not
open").

Any ideas on how to deal with this issue?

Kari
 
J

Jeff Boyce

Kari

Are you saying you can't create a report that shows the same data that your
sub-form does?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

Kari

Jeff,

Thank you for your prompt response. I was out of the office yesterday and
just found your post this morning.

I already had a form that showed the data I needed, in the format I needed
so I just used that in my report (as a subform). I probably could create a
report that would work, but why reinvent the wheel?

Are you saying that I'm stuck with the popup asking to save if I stay with a
subform?

Any ideas on how to (easily) make a report that looks like a datasheet?

Thanks for your help.

Kari

Jeff Boyce said:
Kari

Are you saying you can't create a report that shows the same data that your
sub-form does?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Kari said:
Hi All!

I have a report with a subform. There is a command button on the report
to
close it, but every time it is clicked Access askes if I want to save the
subform. How do I get rid of this annoying popup?

I think the problem stems from the "sub" being a subform, not a subreport
(I
have similar reports with subreports that close just fine). I need it to
be
a form so I can show it in datasheet view.

If I use the "x" button to close the report I am asked if I want to save
the
report and the subreport. Code on the command button is:

DoCmd.Close acReport, "PO Report", acSaveNo

I have tried explicitly closing the subform (DoCmd.Close acReport,
"Reports![PO Report]![PO Order Details subform for PO Report].Form",
acSaveNo), or saving it first (DoCmd.Save acReport, "Reports![PO
Report]![PO
Order Details subform for PO Report].Form" ), all from the command button.
Closing doesn't do anything, and saving generates an error ("Object not
open").

Any ideas on how to deal with this issue?

Kari
 
J

Jeff Boyce

Kari

The reason Access has both Forms and Reports is because they handle
different issues. Forms are great for displaying data, but what you see on
screen doesn't always fit/look so nice when printed. And vice versa...

I believe you've uncovered one of the reasons why you don't want to embed a
form as a subform on a report!

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP


Kari said:
Jeff,

Thank you for your prompt response. I was out of the office yesterday and
just found your post this morning.

I already had a form that showed the data I needed, in the format I needed
so I just used that in my report (as a subform). I probably could create
a
report that would work, but why reinvent the wheel?

Are you saying that I'm stuck with the popup asking to save if I stay with
a
subform?

Any ideas on how to (easily) make a report that looks like a datasheet?

Thanks for your help.

Kari

Jeff Boyce said:
Kari

Are you saying you can't create a report that shows the same data that
your
sub-form does?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Kari said:
Hi All!

I have a report with a subform. There is a command button on the
report
to
close it, but every time it is clicked Access askes if I want to save
the
subform. How do I get rid of this annoying popup?

I think the problem stems from the "sub" being a subform, not a
subreport
(I
have similar reports with subreports that close just fine). I need it
to
be
a form so I can show it in datasheet view.

If I use the "x" button to close the report I am asked if I want to
save
the
report and the subreport. Code on the command button is:

DoCmd.Close acReport, "PO Report", acSaveNo

I have tried explicitly closing the subform (DoCmd.Close acReport,
"Reports![PO Report]![PO Order Details subform for PO Report].Form",
acSaveNo), or saving it first (DoCmd.Save acReport, "Reports![PO
Report]![PO
Order Details subform for PO Report].Form" ), all from the command
button.
Closing doesn't do anything, and saving generates an error ("Object not
open").

Any ideas on how to deal with this issue?

Kari
 

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