hide label in subreport within report

  • Thread starter Thread starter rbeach
  • Start date Start date
R

rbeach

I have a report which utilizes a subreport for the information. within the
subreport is a textbox named "InTol". If the textbox has "IN", I need to hide
a label named "InTolerance", if the textbox has "Out" I need the label
visible. I know the below code will work to make the label visible or not.

If Me!InTol = "OUT" Then
Me!InTolerance.Visible = True
Else
Me!InTolerance.Visible = False
End If

My question is where do put this code in the subreport so it will be read
for each record in the report
 
Rick

Try the Format event of the section of the sub-report where the control is
located (probably in the detail section), but could be in a group header or
footer.
 
I have tried placing this code everywhere, but this only sets to what the
first record is set to. If the first record is set to "Out" then all records
display the label. If the first record is set to "IN" then all the records
hide the label.
 
I can't imagine why the suggestion didn't work if you used the On Format
event of the section containing the control.

However, you could probably do this without code by changing your label to a
text box with a control source of:
=IIf([InTol] = "OUT","Out of Tolerance" , Null)
 
Duane,

I have made the changes per your suggestion and this works. I still do not
unerstand why the code did not work in the On Format event.
--
Rick


Duane Hookom said:
I can't imagine why the suggestion didn't work if you used the On Format
event of the section containing the control.

However, you could probably do this without code by changing your label to a
text box with a control source of:
=IIf([InTol] = "OUT","Out of Tolerance" , Null)

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have tried placing this code everywhere, but this only sets to what the
first record is set to. If the first record is set to "Out" then all records
display the label. If the first record is set to "IN" then all the records
hide the label.
 
I don't understand either. I would probably set a Break Point and step
through the code to determine what's going on.

--
Duane Hookom
Microsoft Access MVP


rbeach said:
Duane,

I have made the changes per your suggestion and this works. I still do not
unerstand why the code did not work in the On Format event.
--
Rick


Duane Hookom said:
I can't imagine why the suggestion didn't work if you used the On Format
event of the section containing the control.

However, you could probably do this without code by changing your label to a
text box with a control source of:
=IIf([InTol] = "OUT","Out of Tolerance" , Null)

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have tried placing this code everywhere, but this only sets to what the
first record is set to. If the first record is set to "Out" then all records
display the label. If the first record is set to "IN" then all the records
hide the label.
--
Rick


:

Rick

Try the Format event of the section of the sub-report where the control is
located (probably in the detail section), but could be in a group header or
footer.

----
HTH
Dale



:

I have a report which utilizes a subreport for the information. within the
subreport is a textbox named "InTol". If the textbox has "IN", I need to hide
a label named "InTolerance", if the textbox has "Out" I need the label
visible. I know the below code will work to make the label visible or not.

If Me!InTol = "OUT" Then
Me!InTolerance.Visible = True
Else
Me!InTolerance.Visible = False
End If

My question is where do put this code in the subreport so it will be read
for each record in the report
 
Can you copy the code from the sub-forms code module and paste it here.
Maybe we can pick-up on something.

----
HTH
Dale



rbeach said:
Duane,

I have made the changes per your suggestion and this works. I still do not
unerstand why the code did not work in the On Format event.
--
Rick


Duane Hookom said:
I can't imagine why the suggestion didn't work if you used the On Format
event of the section containing the control.

However, you could probably do this without code by changing your label to a
text box with a control source of:
=IIf([InTol] = "OUT","Out of Tolerance" , Null)

--
Duane Hookom
Microsoft Access MVP


rbeach said:
I have tried placing this code everywhere, but this only sets to what the
first record is set to. If the first record is set to "Out" then all records
display the label. If the first record is set to "IN" then all the records
hide the label.
--
Rick


:

Rick

Try the Format event of the section of the sub-report where the control is
located (probably in the detail section), but could be in a group header or
footer.

----
HTH
Dale



:

I have a report which utilizes a subreport for the information. within the
subreport is a textbox named "InTol". If the textbox has "IN", I need to hide
a label named "InTolerance", if the textbox has "Out" I need the label
visible. I know the below code will work to make the label visible or not.

If Me!InTol = "OUT" Then
Me!InTolerance.Visible = True
Else
Me!InTolerance.Visible = False
End If

My question is where do put this code in the subreport so it will be read
for each record in the report
 
Did you put the code in the Format event of the sub-form, or the main form?

What version of Access are you using?
 
Back
Top