visible of controls in reports

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

Hi
What I am trying to achieve is let the report hide automatically a number of labels and text box controls if the value of another
control is greater than certain value.

I was trying to assign codes to the "on open" event (tried "on format" as well) something like this:

If Me.MonthlySale>100 then
Me.Message1.Visible = True
Me.Message2.Visible = False
Me.Label103.Visible = False
Me.......
End If

However, first, ".visible" is now available here, secondly if I code them in they don't do anything.

I checked help file which says I can do just that. What is wrong? Can any one please help. (I had no problems in doing this for
forms, but not reports.)

8< -------- From MS Access Help -----------------------
On forms and reports, to hide or unhide a control in response to an event, you can use a macro or event procedure to set the Visible
property. Attach the macro or event procedure to the OnCurrent property of a form or the OnFormat property of a report. For example,
you can show or hide a congratulatory message next to a salesperson's monthly sales total in a sales report, depending on the sales
total.
8< ----------------------------------------------------

Your help would be apprecialted.

Regards

ad
 
Ad,

Try putting your code on the Format event of the report Section that
contains the controls which you want to adjust the visibility of. What
you are trying to do is certainly possible, but it won't work on the
report's Open event.
 
You need to set visibility in the Print event, or the Format event. OnOpen
is too soon. Also, you need an ELSE, because the Visible property won't
automatically be reset on the next record.

Larry Linson
Microsoft Access MVP

ad said:
Hi
What I am trying to achieve is let the report hide automatically a number
of labels and text box controls if the value of another
control is greater than certain value.

I was trying to assign codes to the "on open" event (tried "on format" as well) something like this:

If Me.MonthlySale>100 then
Me.Message1.Visible = True
Me.Message2.Visible = False
Me.Label103.Visible = False
Me.......
End If

However, first, ".visible" is now available here, secondly if I code them in they don't do anything.

I checked help file which says I can do just that. What is wrong? Can any
one please help. (I had no problems in doing this for
forms, but not reports.)

8< -------- From MS Access Help -----------------------
On forms and reports, to hide or unhide a control in response to an event,
you can use a macro or event procedure to set the Visible
property. Attach the macro or event procedure to the OnCurrent property of
a form or the OnFormat property of a report. For example,
you can show or hide a congratulatory message next to a salesperson's
monthly sales total in a sales report, depending on the sales
 
thank you guys very much.

ad

Larry Linson said:
You need to set visibility in the Print event, or the Format event. OnOpen
is too soon. Also, you need an ELSE, because the Visible property won't
automatically be reset on the next record.

Larry Linson
Microsoft Access MVP


of labels and text box controls if the value of another
one please help. (I had no problems in doing this for
you can use a macro or event procedure to set the Visible
a form or the OnFormat property of a report. For example,
monthly sales total in a sales report, depending on the sales
 
Back
Top