|
Question : sub report with null fields
|
|
my report with the sub report will not print when there is nothing in the sub report
i am using a form with a print preview button - with the following code
Private Sub Print_Preview_Click() On Error GoTo Err_Print_Preview_Click
Dim stDocName As String
stDocName = "NewGrievanceReport" DoCmd.OpenReport "NewGrievanceReport", acPreview, , "[GrievancesTbl_new].[ID]=" & Me.Involved_subform.Form.IDLink Exit_Print_Preview_Click: Exit Sub
Err_Print_Preview_Click: MsgBox Err.Description Resume Exit_Print_Preview_Click End Sub
|
|
Answer : sub report with null fields
|
|
ssblue: I'm going to bet that the query for this report's subreport uses INNER joins or no joins at all. This means that if there is no match between the records of the main report and the sub report that you WILL NOT GET a return of records.
Change the query of the subreport to include the main table from the main report. Use Master/Child linking to have the subreport associate UPWARD to the main report on the key fields.
What you want to happen is that in EVERY report you want a record (even if there are alot of null values) to populate the subreport. You can do this by having part of the main table act as that record. Using LEFT JOINS from Main table to sub table you create a condition where the main supplies the key fields for the subreport record, EVEN IF NO RECORD EXISTS IN THE SUB TABLE.
does this make sense to you? -j-
|
|
|