Access fields on a report

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
 
K

kingston via AccessMonster.com

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?
 
G

Guest

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.
 
R

ricky

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
 
R

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.
 
G

Guest

Open your report in design view. Select the Properties Dialog, Select the
Report, Click on the Events tab.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top