Access fields on a report

  • Thread starter Thread starter ricky
  • Start date Start date
R

ricky

Hi

I have a report, which if a query does not return any data, I then need to
write some text on to a report (passed in from the form), is it possible to
access report fields?

Kind Regards

Ricky
 
Could you check the query first and then open the corresponding report? IOW,
one report would open if the query had records and the other report would
open if the query returned no records?
 
Yes, you reference them just like you would on a form:
Me.txtSomeTextBox = "No Data to Report"

You would do this in the No Data event of the report.

Be aware, also, that if you cancel the report in the No Data event, the
calling code will throw an error 2501. You will want to trap and ignore that
error in your error handler.
 
Good idea chap......

I'll give it a try....although is there anyway I can write the value from
the Query prompt on the form....?

Kind Regards

Ricky
 
Stupid question, but how do I access this event?

Klatuu said:
Yes, you reference them just like you would on a form:
Me.txtSomeTextBox = "No Data to Report"

You would do this in the No Data event of the report.

Be aware, also, that if you cancel the report in the No Data event, the
calling code will throw an error 2501. You will want to trap and ignore that
error in your error handler.
 
Open your report in design view. Select the Properties Dialog, Select the
Report, Click on the Events tab.
 
Back
Top