Subreports in 2K3 & conversion from 97

D

Darryl

I've converted a database from 97 to 2K3 by opening it with 2K3.

However, I have a report A which contains subreport B, and subreport B
contains subreport B1.

Subreport B converted to type "subform/subreport" within report A and
has a name "subreport B". That's correct.

But subreport B1 converted as a "Report" object, not as a
subform/subreport object, and has no name property. Because of this,
the code that referenced the fields on that subreport B1 is failing.

Is there any way to convert an object "Report" within a report to a
subform/subreport type? I'd hate to have to go into each report
(there's more than one, and this conversion error happened to all of
them) and delete the "Report" objects and reinsert them all as
"subform/subreport" objects.
 
A

Allen Browne

Darryl, I've seen the converter do some weird things, but not this one.

I'm not sure I understand. In the original A97 mdb, when you look on the
Reports tab of the Database window, you will see the reports and subreports
listed. This should be the case in the converted A2003 mdb too. Is it?

When you open the report in design view in A97, you should see a
subform/subreport control. It looks like a white rectangle. It has a
SourceObject property, which is the name of the Report that gets loaded into
the subreport control when it runs. The same should happen when you load the
first subreport in design view directly from the Database window, i.e. you
see the white rectangle that is the subreport control.

In A2003, things are a little different. When you open the main report in
design view, you see the subreport shown in situ, i.e. you see the contents
of the subreport instead of just the white rectangle. And since this
subreport has a nested subreport, you will see that in situ inside the other
subreport (assuming there's enough height to see it.)

If that is not what you see, then I don't follow what happens. There is no
such thing as a Report *control*, so there can't be a report object inside a
report. If it's not a subreport control there, perhaps it was wrongly
converted as something else, but I can't imagine a report control, since
there is no such thing in Access.
 
D

Darryl

Allen said:
Darryl, I've seen the converter do some weird things, but not this one.

I'm not sure I understand. In the original A97 mdb, when you look on the
Reports tab of the Database window, you will see the reports and subreports
listed. This should be the case in the converted A2003 mdb too. Is it?
yes.


When you open the report in design view in A97, you should see a
subform/subreport control. It looks like a white rectangle. It has a
SourceObject property, which is the name of the Report that gets loaded into
the subreport control when it runs. The same should happen when you load the
first subreport in design view directly from the Database window, i.e. you
see the white rectangle that is the subreport control.

In A2003, things are a little different. When you open the main report in
design view, you see the subreport shown in situ, i.e. you see the contents
of the subreport instead of just the white rectangle. And since this
subreport has a nested subreport, you will see that in situ inside the other
subreport (assuming there's enough height to see it.)

Yes. My confusion was because if you expand the subreport AT ALL, &
select Properties, you get the underlying Report properties (and it
displays as a Report), not the Subreport properties (which displays as
Subform/Subreport). So it displays as a Report unless you're very,
very careful in selecting before right-clicking. I'm so used to
right-clicking on the top-left black square for Properties. Change in
behavior from 97.

However, I seem to be unable to reference fields in the subreports from
the report. Code that worked fine in 97 is failing in 2003.

If the subreport name is "SubR: tasty", and I reference in code [SubR:
tasty]![FullName], it says "Runtime error 2427 You referenced an
expression that has no value." If I use [SubR: tasty]![FullName].Text,
I get "Runtime error 2185: You can't reference a property or method for
a control unless the control has focus". The former code is the
original.

How do I now, in 2003, access the fields in a subreport from the parent
report's detail section code? There's apparently been a change in
behavior since 97/2000.
 
A

Allen Browne

You're right, Darryl. Access 2003 *is* more pedantic about the way you refer
to subforms and subreports.

You must use the .Report bit to refer to the report in the subreport
control, e.g.:
=[SubR: tasty].Report![FullName]
That syntax works in both versions, and is explained here:
http://allenbrowne.com/casu-04.html

BTW, if you want to edit the subreport in its own window like you did in
A97, right-click the subreport control and you get the option to do so. MS
added this to 2003 (it's not in 2000 or 2002) because lots of us prefer to
do it that way.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Darryl said:
Allen said:
Darryl, I've seen the converter do some weird things, but not this one.

I'm not sure I understand. In the original A97 mdb, when you look on the
Reports tab of the Database window, you will see the reports and
subreports
listed. This should be the case in the converted A2003 mdb too. Is it?
yes.


When you open the report in design view in A97, you should see a
subform/subreport control. It looks like a white rectangle. It has a
SourceObject property, which is the name of the Report that gets loaded
into
the subreport control when it runs. The same should happen when you load
the
first subreport in design view directly from the Database window, i.e.
you
see the white rectangle that is the subreport control.

In A2003, things are a little different. When you open the main report in
design view, you see the subreport shown in situ, i.e. you see the
contents
of the subreport instead of just the white rectangle. And since this
subreport has a nested subreport, you will see that in situ inside the
other
subreport (assuming there's enough height to see it.)

Yes. My confusion was because if you expand the subreport AT ALL, &
select Properties, you get the underlying Report properties (and it
displays as a Report), not the Subreport properties (which displays as
Subform/Subreport). So it displays as a Report unless you're very,
very careful in selecting before right-clicking. I'm so used to
right-clicking on the top-left black square for Properties. Change in
behavior from 97.

However, I seem to be unable to reference fields in the subreports from
the report. Code that worked fine in 97 is failing in 2003.

If the subreport name is "SubR: tasty", and I reference in code [SubR:
tasty]![FullName], it says "Runtime error 2427 You referenced an
expression that has no value." If I use [SubR: tasty]![FullName].Text,
I get "Runtime error 2185: You can't reference a property or method for
a control unless the control has focus". The former code is the
original.

How do I now, in 2003, access the fields in a subreport from the parent
report's detail section code? There's apparently been a change in
behavior since 97/2000.
 

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