CONTROL VISIBILITY OF FIELDS ON A REPORT BASED ON CRITERIA

S

Sammie

I have a report called Invoice (which prints for 1 record only). It
loads with a filter specifying the particular record to be shown on the
report. I have 2 sets of addresses based on whether the "SoldTo" field
on the query the report is based on is null or not. I want to use just
1 report because it is complicated and I expect to be editing it alot,
and I don't want to be changing it in two places. The only section on
the report that is different is the address section. What's the best
way to approach this? I am trying to change the "visible" property on
each of the address fields in the "On Activate" property of the report,
based on the IsNull condition of the SoldTo field. Could the criteria
for the IsNull condition be specified on the filter used to load the
report? Could I somehow group the address fields in question and apply
a visible property with one statement?

Here is a sample from my "on activate" report event:
If IsNull (SoldTo) then
SoldToCompany.visible = true
SoldToCCCompany.visible = false
SoldToAddress.visible = visible
SoldToCCAddress.visible = false
etc.
End if

If I do use the above code, should each address field's visible property
be set to yes or no? (Or does it matter?)

Thanks.
Sammie
 
M

Marshall Barton

Sammie said:
I have a report called Invoice (which prints for 1 record only). It
loads with a filter specifying the particular record to be shown on the
report. I have 2 sets of addresses based on whether the "SoldTo" field
on the query the report is based on is null or not. I want to use just
1 report because it is complicated and I expect to be editing it alot,
and I don't want to be changing it in two places. The only section on
the report that is different is the address section. What's the best
way to approach this? I am trying to change the "visible" property on
each of the address fields in the "On Activate" property of the report,
based on the IsNull condition of the SoldTo field. Could the criteria
for the IsNull condition be specified on the filter used to load the
report? Could I somehow group the address fields in question and apply
a visible property with one statement?

Here is a sample from my "on activate" report event:
If IsNull (SoldTo) then
SoldToCompany.visible = true
SoldToCCCompany.visible = false
SoldToAddress.visible = visible
SoldToCCAddress.visible = false
etc.
End if

If I do use the above code, should each address field's visible property
be set to yes or no? (Or does it matter?)


If you make all all the text boxes visible in design view,
then you only have to make the appropriate ones invisible at
run time.

The Activate event is totally inappropriate for this, since
it only fires in preview mode. Use the Format event of the
section that contains the address text boxes.
 

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