Report property: On No Data

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi,

I have a report that is based off a query
called, "queryReportClassEnrollment". When the user opens
the report he/she is asked to "enter class ID number".
The report lists the details of the class (i.e. date,
time, location, etc.) and below that lists employees who
has enrolled into that class. Currently, if no employees
(no records) are enrolled into that class the report opens
with "error" written where fields would be filled in with
the appropriate record. Instead, I would like to have a
message box come up stating that no on has enrolled into
this particular class, then close the report.

I have been looking online to find out about the report's
event property "On No Data", but I am not finding out much
at all. When I try to use an event procedure in the "On
No Data" property... specifically, the "DoCmd.Close" I get
a error. Can I use the On No Data property? How would I
go about accomplishing this task?

Thanks for the help!
 
Hi,

I have a report that is based off a query
called, "queryReportClassEnrollment". When the user opens
the report he/she is asked to "enter class ID number".
The report lists the details of the class (i.e. date,
time, location, etc.) and below that lists employees who
has enrolled into that class. Currently, if no employees
(no records) are enrolled into that class the report opens
with "error" written where fields would be filled in with
the appropriate record. Instead, I would like to have a
message box come up stating that no on has enrolled into
this particular class, then close the report.

I have been looking online to find out about the report's
event property "On No Data", but I am not finding out much
at all. When I try to use an event procedure in the "On
No Data" property... specifically, the "DoCmd.Close" I get
a error. Can I use the On No Data property? How would I
go about accomplishing this task?
You need to cancel the opening of the report.

MsgBox "No one has enrolled!"
Cancel = True

- Jim
 
Back
Top