associates
IS-IT--Management
Hi,
I have got a question. I have a report that has a subreport. And they are linked by job_ID.
I know how to check if there is no data on the report by calling sub report_NoData (something like that).
However, because i have a subreport that has a textbox, say text68, i don't know how to check if the data. Hence, it's giving me error message saying no data.
I guess, what i want is either being able to show the report without the subreport because the subreport has no data and just show "No data" for the subreport or not showing the report at all.
Here is my code:
Private Sub CM_JobInvoice_Click()
On Error Resume Next
Dim stDocName As String
If Not IsNull(Me.CB_Industry) And Me.CB_Industry <> "*" Then
If Not IsNull(Me.CB_Client) And Me.CB_Client <> "*" Then
If Not IsNull(Me.CB_Job) And Me.CB_Job <> "*" Then
stDocName = "JobInvoice Work Hours"
DoCmd.OpenReport stDocName, acPreview
Else
MsgBox "Please select a job number"
End If
Else
MsgBox "Please select a job number"
End If
Else
MsgBox "Please select a job number"
End If
If Err = 2501 Then Err.Clear
End Sub
Private Sub Report_NoData(Cancel As Integer)
MsgBox "No data found! Closing report."
Cancel = True
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
'MsgBox "text51 is" + CStr(Me.[Invoice Summary1].Report.Text68)
'MsgBox "Job name is " + Me.[Invoice Summary1].Report.Job_Name
If Not IsNull(Me.[Invoice Summary1].Report.Text68) And Me.[Invoice Summary1].Report.Text68 <> "" Then
Me.Text51 = Me.[Invoice Summary1].Report.Text68
Me.Text52 = Val(Me.Text50) - Val(Me.Text51)
End If
End Sub
Thank you in advance and look forward to hearing from you.
I have got a question. I have a report that has a subreport. And they are linked by job_ID.
I know how to check if there is no data on the report by calling sub report_NoData (something like that).
However, because i have a subreport that has a textbox, say text68, i don't know how to check if the data. Hence, it's giving me error message saying no data.
I guess, what i want is either being able to show the report without the subreport because the subreport has no data and just show "No data" for the subreport or not showing the report at all.
Here is my code:
Private Sub CM_JobInvoice_Click()
On Error Resume Next
Dim stDocName As String
If Not IsNull(Me.CB_Industry) And Me.CB_Industry <> "*" Then
If Not IsNull(Me.CB_Client) And Me.CB_Client <> "*" Then
If Not IsNull(Me.CB_Job) And Me.CB_Job <> "*" Then
stDocName = "JobInvoice Work Hours"
DoCmd.OpenReport stDocName, acPreview
Else
MsgBox "Please select a job number"
End If
Else
MsgBox "Please select a job number"
End If
Else
MsgBox "Please select a job number"
End If
If Err = 2501 Then Err.Clear
End Sub
Private Sub Report_NoData(Cancel As Integer)
MsgBox "No data found! Closing report."
Cancel = True
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
'MsgBox "text51 is" + CStr(Me.[Invoice Summary1].Report.Text68)
'MsgBox "Job name is " + Me.[Invoice Summary1].Report.Job_Name
If Not IsNull(Me.[Invoice Summary1].Report.Text68) And Me.[Invoice Summary1].Report.Text68 <> "" Then
Me.Text51 = Me.[Invoice Summary1].Report.Text68
Me.Text52 = Val(Me.Text50) - Val(Me.Text51)
End If
End Sub
Thank you in advance and look forward to hearing from you.