Report control invisible

  • Thread starter Thread starter Joan
  • Start date Start date
J

Joan

I'm reposting this as I forgot to put a subject on the first one I posted.

Can anyone tell me how to go about setting a control on a report to be
invisible depending upon which of two labels are double-clicked on a form
to open the report?
I have a report with two labels. If one label is double-clicked, I want a
report to open with all the informatiion on it.
If the other label is double-clicked , I'd like the same report to open only
without the cost information field. Do I set the control to be invisible on
the On Open event of the report? If so, how do you code this? Is it
something like:
If Forms![Reports Menu]![lblWithoutCost].OnDblClick = True Then
Me.[Purchase Price].Visible = False.

I thought that this would be easier than setting a new SQL for the report.

Would be appreciative knowing the best way to work this.

Thanks,
Joan
 
Joan said:
I'm reposting this as I forgot to put a subject on the first one I posted.

Can anyone tell me how to go about setting a control on a report to be
invisible depending upon which of two labels are double-clicked on a form
to open the report?
I have a report with two labels. If one label is double-clicked, I want a
report to open with all the informatiion on it.
If the other label is double-clicked , I'd like the same report to open only
without the cost information field. Do I set the control to be invisible on
the On Open event of the report? If so, how do you code this? Is it
something like:
If Forms![Reports Menu]![lblWithoutCost].OnDblClick = True Then
Me.[Purchase Price].Visible = False.

I thought that this would be easier than setting a new SQL for the report.

Two ways come to mind. You could create a global variable in a module. Let's
call it CostInfoOption and make it a Boolean. In the DoubleClick event on the
form where you want to see the cost information add a line of code before the
line that opens the report that set the variable to True. In the DoubleClick
event of the other label, add a line that sets the variable to false. In the
report's Open event use code similar to. . .

Me.CostInformation.Visible = CostInfoOption

Instead of a global variable you could just have a hidden control on the form
and set it to True or False and have your report use that.
 
Joan said:
I'm reposting this as I forgot to put a subject on the first one I posted.

Can anyone tell me how to go about setting a control on a report to be
invisible depending upon which of two labels are double-clicked on a form
to open the report?
I have a report with two labels. If one label is double-clicked, I want a
report to open with all the informatiion on it.
If the other label is double-clicked , I'd like the same report to open only
without the cost information field. Do I set the control to be invisible on
the On Open event of the report? If so, how do you code this? Is it
something like:
If Forms![Reports Menu]![lblWithoutCost].OnDblClick = True Then
Me.[Purchase Price].Visible = False.

I thought that this would be easier than setting a new SQL for the report.

Would be appreciative knowing the best way to work this.

Thanks,
Joan
Joan,
Just use a simple Check Box on the form.
Code the Report's Detail Format section (if the [Purchase Price] control
is placed in the Detail section):

Me![Purchase Price].Visible = forms![Reports Menu]![CheckBoxName]

The form must remain open while the report is run.
You can close the form (if you wish) in the report's Close event.

If the Form check box is checked, the control is visible. Otherwise it
is not visible.
You can use
Me![Purchase Price].Visible = Not forms![Reports Menu]![CheckBoxName]
to reverse the logic if that suits you better.
 
Thanks Rick!
I followed your global variable example and it works great! This report
can also be opened from another form, so set the value of the global
variable in those events on the other form too. This works slick when you
have more than one place to open the report. Thanks again,

Joan

Rick Brandt said:
Joan said:
I'm reposting this as I forgot to put a subject on the first one I posted.

Can anyone tell me how to go about setting a control on a report to be
invisible depending upon which of two labels are double-clicked on a form
to open the report?
I have a report with two labels. If one label is double-clicked, I want a
report to open with all the informatiion on it.
If the other label is double-clicked , I'd like the same report to open only
without the cost information field. Do I set the control to be invisible on
the On Open event of the report? If so, how do you code this? Is it
something like:
If Forms![Reports Menu]![lblWithoutCost].OnDblClick = True Then
Me.[Purchase Price].Visible = False.

I thought that this would be easier than setting a new SQL for the
report.

Two ways come to mind. You could create a global variable in a module. Let's
call it CostInfoOption and make it a Boolean. In the DoubleClick event on the
form where you want to see the cost information add a line of code before the
line that opens the report that set the variable to True. In the DoubleClick
event of the other label, add a line that sets the variable to false. In the
report's Open event use code similar to. . .

Me.CostInformation.Visible = CostInfoOption

Instead of a global variable you could just have a hidden control on the form
and set it to True or False and have your report use that.
 
Back
Top