access fields on a report, through VBA code

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, is it possible to access report fields?

Kind Regards

Ricky
 
G

Geoff

Ricky:
Open the report's properties dialog and, on the Event page, select [Event
Procedure] in the NoData property. Click the build button ( ... on the
right) and write code in the Report_NoData event procedure. You could make
the Textboxes bound to fields invisible and make an invisible unbound
Textbox visible and put some text into it. You could even make a whole
report section, like the Detail Section, invisible.
Regards
Geoff
 
M

Marshall Barton

ricky said:
I have a report, which if a query does not return any data, I then need to
write some text on to a report, is it possible to access report fields?


Nitpicking, but reports (and forms) do not contain fields.
their RecordSource table/query does.

The trick is to use the report's HasData property to make a
label control visible or not.

Use the Format event of the section that contains the lable
control:

Me.thelabel.Visible = Not Me.HasData
 

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