Anytime I've ever used a subreport it disappears automatically if there is no data to report on. Are you using an unbound subreport? Joe Miller
joe.miller@flotech.net
nope! The subforms are bound to subreports. I don't get any data if there isn't any. I do have labels in the subreports that print no matter what. I could move the labels out into the main report. Basically what I am trying to do is fit all of the information in one report on one page. The particular subforms that I am trying to hide do not have data most of the time, so if I could hide them when there is no data I can save some space.
Sera
You know what...I can't move the labels into the main report because then that defeats the purpose of what I am trying to do. I don't even want it to look like those subreports exist if there is no data in them. I hope I am not confusing you.
Sera
My report has labels as well and a report header so that I can print them standalone if desired, they disappear when printed as a subreport. What section are the labels placed in? I have labels in the Page Header and the Report Header only, maybe that makes a difference? Joe Miller
joe.miller@flotech.net
You know what else...in each subreport I have an unbound textbox that is tied to a function. I use this function to output all of the records in a comma delimited line. Maybe this has something to do with the reason that my subreports are not disappearing automatically. I will post the code...
Function BlendTheData(strSQL As String) As String
On Error GoTo Err1
Dim Rs As Recordset, Db As DATABASE, fld As Field
Set Db = CurrentDb()
Set Rs = Db.OpenRecordset(strSQL, dbOpenSnapshot)
For Each fld In Rs.Fields
BlendTheData = fld.Value
Next
Rs.MoveNext
Do Until Rs.EOF
For Each fld In Rs.Fields
BlendTheData = BlendTheData & ", " & fld.Value
Next
Rs.MoveNext
Loop
Exit1:
Exit Function
Err1:
MsgBox Err.Number & " " & Err.Description, vbInformation, "Sera is Dumb..."
Resume Exit1
End Function
I am pretty new at writing code in Visual Basic. But maybe you can see something I am not seeing...I wasn't trying to stump you...
Sera
do the commas appear when you run the report? If they are appearing then you need to test for only commas (IE: no records) and set your string to "" in your code. Joe Miller
joe.miller@flotech.net
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.