Can I use a subform on a report?

  • Thread starter Thread starter Max Moor
  • Start date Start date
M

Max Moor

Hi All,
I want a datasheet view on a report. I stuck a subform set up for
one in the detail section of my report. In the report's Open code, I want
to run some code settnig the form up. I get an error when I run the code
line:

Set frm = Me!fsub_Datasheet.Form

It says it can't find fsubDatasheet. Am I breaking the rules all
around? Should this work in the first place?

- Max
 
Max

Uhm, get ready for a "V8" moment... <G>

You'd use a subreport on a report, not a subform. Same concept as a subform
on a main form, only using reports to do it.
 
Max

Uhm, get ready for a "V8" moment... <G>

You'd use a subreport on a report, not a subform. Same concept as a
subform on a main form, only using reports to do it.


Of course, I understand that. What I want to know is if that constraint
can be broken. As I said before, I'm after a datasheet view, on my report.
As near as I can see, a report doesn't give you this option, hence my
desire to use a form. I gather the answer is no.
 
Max

It wasn't clear from your original post if you understood subform/subreport,
hence, my aside...

Perhaps one of the other 'group readers can offer a way to do this.
However, if you'd be willing to describe what you want to accomplish, rather
than how ("with a datasheet"), there may be more than one way to do it.
 
Max

It wasn't clear from your original post if you understood
subform/subreport, hence, my aside...

Perhaps one of the other 'group readers can offer a way to do this.
However, if you'd be willing to describe what you want to accomplish,
rather than how ("with a datasheet"), there may be more than one way
to do it.


I eventually ran across a KB article desribing a problem exporting a
recordset to excel (et al) if a subform in datasheet view was used as a
report. That leads me to believe it can be done. The solution in the
article was to save the datasheet form as a report, then use that. When I
tried it, I lost the datasheet view. Oh well.
I bit the bullet, and put a subform together with bunch of text boxes.
I'm making them visible, or not, and setting the size and position in the
form open event. I was just hoping for a subform datasheet, as I already
have one doing the same thing I could have cut and pasted, and shortcuts
are often good things.
I do appreciate your answer from before. I know it's not always easy
to tell (especially if I don't specify) what level a question is being
asked at. Believe me, the folks that answer questions in here - MVP and
otherwise - are, along with the Dev. Handbook and Knowledge Base, the best
resources around.

TTFN, Max
 
"Max Moor" wrote
I eventually ran across a KB article
desribing a problem exporting a
recordset to excel (et al) if a subform
in datasheet view was used as a
report. That leads me to believe it can
be done. The solution in the article was
to save the datasheet form as a report,
then use that. When I tried it, I lost the
datasheet view. Oh well.

If my memory does not fail me, you can insert a Form into a Subreport
Control*. I have not tried, nor given any thought to using Datasheet view of
that Form. Again, IIRC, even though you have embedded a Form rather than a
Report, you'd refer to the _Report_ property of the Subreport control, e.g.,

Me!sbfSRC.Report!txtSomeBox

* but the converse is not true -- you cannot successfully
embed a Report in a Subform Control.

I'm not fond of Datasheet view in Forms because the user has too many
opportunities to inadvertently do something unexpected. That wouldn't be
true in a Report -- but I don't know if you can do it. I am wondering why
code to export a recordset would be affected by the way the data is
displayed in a Subreport, though?

Larry Linson
Microsoft Access MVP
 
I'm not fond of Datasheet view in Forms because the user has too many
opportunities to inadvertently do something unexpected.

True enough.
That wouldn't be true in a Report -- but I don't know if you can do it. I
am wondering why code to export a recordset would be affected by the way
the data is displayed in a Subreport, though?

Something to do with the processing of the data. Here's the article...

ACC2000: Cannot Export a Report with a Datasheet Form As a Subreport

TTFN
 
Back
Top