Subreport Problems

  • Thread starter Thread starter sufeng
  • Start date Start date
S

sufeng

Guest
I have a report that contains a subreport. The main report prints information about a device first and subreport prints all the settings of that device after that. Here comes my problem. I want to print some of the settings in subreport if only if one of the fields in main report is empty.

Thanks,
Sufeng
 
You need some VB code for this:

if Reports("ReportName").TextBox.value = "" then
SubreportComponents.visible = false
else
SubreportComponents.visible = true
end if
 
Thanks for your help. But it would work. It seems to me when subreport is opening up. It displays everything at one time. It wouldn't check each element code with my if statement in Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer).

I have attached a pic of my report. Hope it will give some help.

My program checks if anything is in Custom Test Schedule. If there is, it will print only Element Code with TAP as its value. Otherwise everything.

Thanks

BTW, those relay settings at bottom of the report are subreport.
 

Attachments

  • sample.jpg
    sample.jpg
    98.2 KB · Views: 143
Last edited:
If somethnig like this still doesn't work, can you put your code?

Code:
DoCmd.OpenReport SubreportName, acViewDesign
    With Reports(SubreportName)
        if Reports(MainReportName).MainTextBox.value = "" then 
           .TextBox.visible = false 
           .TextBox.ControlSource = ""
        else 
           .TextBox.visible = true 
           .TextBox.ControlSource = "=[Forms]![FormName]![TextBoxName]"
        end if
    End With
 
I tried it. It didn't work. I will put my DB on a website.

This access has been working on by many people over the years now. We are adding more and more into it.

The reports that I am currently working on : [Relay Settings], [Relay Settings1], [RelaySetting(Median)], [Relay Setting(Median)], and [Report On Relay Setting All(Median)]. [Report On Relay Setting All(Median)] is the main report. Others just the subreports I have been trying to figure out. Everything else in the Access Report are not use by me.

Here is how to view the report. Open Switchboard | Click on Relays | then select ALL | last click on VIEW ALL.


http://www.cs.ndsu.nodak.edu/~scai/Sample.zip

Thanks.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom