sub report text field not visible in main report

J

Jesse

So here's the situation. I have a report that contains a sub-report
in a group header. In the footer section of the sub-report, there are
5 text boxes. The values in these text boxes are generated by a
series of if statements when the report loads. If a certain field
contains data, it goes in text box 1. If that field doesn't contain
data, the next field that contains data goes in text box 1. Etc
etc... The if statements are work just fine because when you open the
sub-report on its own, all the appropriate data is in the appropriate
text box. But here's the rub... When you open the main report in
report view, the values in the text boxes are missing. When I click
where the values should be, they show up. But then I go to print
preview and they're missing again (and won't print). Anyone have any
thoughts/suggestions?

jesse
 
D

Duane Hookom

We need more detail regarding your "series of if statements when the report
loads".
 
J

Jesse

well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.

if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if

The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.

does this make sense?

jesse
 
D

Duane Hookom

You should provide more code so we know where the code is running (which
event).

I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Jesse said:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.

if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if

The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.

does this make sense?

jesse

We need more detail regarding your "series of if statements when the report
loads".
 
J

Jesse

Private Sub Report_Load()
'construction sub report

if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if


You should provide more code so we know where the code is running (which
event).

I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm

Jesse said:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.
if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if
The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.
does this make sense?
 
J

Jesse

Alright making the text boxes' have control sources with iif
statements worked. But what's the difference? Does the vb code not
run when a report is embedded as a subform? Now i'm just curious.
Thanks for your help

jesse

You should provide more code so we know where the code is running (which
event).

I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm

Jesse said:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.
if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if
The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.
does this make sense?
 
D

Duane Hookom

Your code might have worked if it was located in some other event such as the
On Format event of the section containing the controls.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Jesse said:
Alright making the text boxes' have control sources with iif
statements worked. But what's the difference? Does the vb code not
run when a report is embedded as a subform? Now i'm just curious.
Thanks for your help

jesse

You should provide more code so we know where the code is running (which
event).

I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm

Jesse said:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.
if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if
The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.
does this make sense?

On Nov 30, 10:04 am, Duane Hookom <duanehookom@NO_SPAMhotmail.com>
wrote:
We need more detail regarding your "series of if statements when the report
loads".
:
So here's the situation. I have a report that contains a sub-report
in a group header. In the footer section of the sub-report, there are
5 text boxes. The values in these text boxes are generated by a
series of if statements when the report loads. If a certain field
contains data, it goes in text box 1. If that field doesn't contain
data, the next field that contains data goes in text box 1. Etc
etc... The if statements are work just fine because when you open the
sub-report on its own, all the appropriate data is in the appropriate
text box. But here's the rub... When you open the main report in
report view, the values in the text boxes are missing. When I click
where the values should be, they show up. But then I go to print
preview and they're missing again (and won't print). Anyone have any
thoughts/suggestions?
 
J

Jesse

so I thought it was working but it's not. Let me re-explain the
problem. I have a report with text boxes that are generated based on
fields on that report. When I load the report, it works fine. When I
embed that report into another report (making it a sub-report), the
generated text boxes are empty. If I click on the empty boxes (still
in the main report view), and then click off the sub report, the
values of the text boxes in the sub report show up. I've been working
on this all day and am very frustrated. Any suggestions before monday?

jesse


Your code might have worked if it was located in some other event such as the
On Format event of the section containing the controls.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm

Jesse said:
Alright making the text boxes' have control sources with iif
statements worked. But what's the difference? Does the vb code not
run when a report is embedded as a subform? Now i'm just curious.
Thanks for your help

You should provide more code so we know where the code is running (which
event).
I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.
--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm
:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.
if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if
The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.
does this make sense?
jesse
On Nov 30, 10:04 am, Duane Hookom <duanehookom@NO_SPAMhotmail.com>
wrote:
We need more detail regarding your "series of if statements when the report
loads".
--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm
:
So here's the situation. I have a report that contains a sub-report
in a group header. In the footer section of the sub-report, there are
5 text boxes. The values in these text boxes are generated by a
series of if statements when the report loads. If a certain field
contains data, it goes in text box 1. If that field doesn't contain
data, the next field that contains data goes in text box 1. Etc
etc... The if statements are work just fine because when you open the
sub-report on its own, all the appropriate data is in the appropriate
text box. But here's the rub... When you open the main report in
report view, the values in the text boxes are missing. When I click
where the values should be, they show up. But then I go to print
preview and they're missing again (and won't print). Anyone have any
thoughts/suggestions?
jesse
 
D

Duane Hookom

Where in your subreport (which section) are the controls located?
Did you try place your code in another event of the subreport?
Why are you even using code?
Did you try writing a small function to return the results?

If you remain frustrated with this, reply back with all your code and what
you expect to happen.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Jesse said:
so I thought it was working but it's not. Let me re-explain the
problem. I have a report with text boxes that are generated based on
fields on that report. When I load the report, it works fine. When I
embed that report into another report (making it a sub-report), the
generated text boxes are empty. If I click on the empty boxes (still
in the main report view), and then click off the sub report, the
values of the text boxes in the sub report show up. I've been working
on this all day and am very frustrated. Any suggestions before monday?

jesse


Your code might have worked if it was located in some other event such as the
On Format event of the section containing the controls.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCPhttp://www.access.hookom.net/UCP/Default.htm

Jesse said:
Alright making the text boxes' have control sources with iif
statements worked. But what's the difference? Does the vb code not
run when a report is embedded as a subform? Now i'm just curious.
Thanks for your help

On Nov 30, 10:42 am, Duane Hookom <duanehookom@NO_SPAMhotmail.com>
wrote:
You should provide more code so we know where the code is running (which
event).
I would probably either set control sources using =IIf( ) or write a
small user-defined function that would return the appropriate value to
display.
:
well it's a lot of code because it is for a total of five fields and
five text boxes but basically it's this.
if [field1]=0 then
if [field2]=0 then
'do nothing
else
text1=[field1]
end if
else
text1=[field1]
if [field2]=0 then
'do nothing
else
text2=[field2]
end if
end if
The code works because when you load the report that is for, the
values show up appropriately. they just don't show up when that
report is used as a sub report on another report.
does this make sense?

On Nov 30, 10:04 am, Duane Hookom <duanehookom@NO_SPAMhotmail.com>
wrote:
We need more detail regarding your "series of if statements when the report
loads".
:
So here's the situation. I have a report that contains a sub-report
in a group header. In the footer section of the sub-report, there are
5 text boxes. The values in these text boxes are generated by a
series of if statements when the report loads. If a certain field
contains data, it goes in text box 1. If that field doesn't contain
data, the next field that contains data goes in text box 1. Etc
etc... The if statements are work just fine because when you open the
sub-report on its own, all the appropriate data is in the appropriate
text box. But here's the rub... When you open the main report in
report view, the values in the text boxes are missing. When I click
where the values should be, they show up. But then I go to print
preview and they're missing again (and won't print). Anyone have any
thoughts/suggestions?
 

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