Derek Brown
asked on
HasData
I have a Report that has 3 sub reports. Each, all or none can have data. How do I stop the main and all reports printing if the subreports have no data
In the Main Report's Load event, you will need to run two queries - one for each subform and count the related records. If none are found, you can cancel the report. Use the normal OnNoData method to cancel the main report.
try using the open event of the Main report to check if the sub report have data
private sub Report_Open(cancel as integer)
if Not me.subreportcontolname.rep ort.hasdat a then
msgbox "No data in subreport"
cancel=true
end if
end sub
private sub Report_Open(cancel as integer)
if Not me.subreportcontolname.rep
msgbox "No data in subreport"
cancel=true
end if
end sub
ASKER
Hi Ray
Can't get that to work. Unrecognised procedure
Pat
I do not have an load event for the report
Can't get that to work. Unrecognised procedure
Pat
I do not have an load event for the report
which line is raising the error?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There is always many different ways to solve access problems I will try them and respond
ASKER
Sorry used these comments to solve problem. Cannot believe I forgot to close.
Thank you both
Thank you both