How to code before opening a report

I

Ixak

Hello,
What I´d like to do is to delete or not to print a data in a label depending
a criteria.
For example:
if visa.text = "0?" then
visa.text =""
end if

Something like that.
Where visa is a label from the report. I try to write this code on the open
event from the report but it doesn´t work. How could I do something like
this?
Thank a lot
I am using access 2003 pro
 
M

Marshall Barton

Ixak said:
Hello,
What I´d like to do is to delete or not to print a data in a label depending
a criteria.
For example:
if visa.text = "0?" then
visa.text =""
end if

Something like that.
Where visa is a label from the report. I try to write this code on the open
event from the report but it doesn´t work.


First, don't use the Text property, use the Value property.

Second, you can not refer to the report's data or control
values in the Open event. The Open event can only be used
to set non-data specific properties (RecordSource,
ControlSource, Visible, etc).

Third, for something this simple, you don't need any code.
Just set the text box's control source to an expression
like:
=IIf(visa Like "0?", "", visa)
 

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