hide label in subreport within report

  • Follow


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
0
Reply Utf 12/7/2009 5:20:01 PM

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



"rbeach" wrote:

> 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
0
Reply Utf 12/7/2009 5:35:01 PM


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


"Dale Fye" wrote:

> 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
> 
> 
> 
> "rbeach" wrote:
> 
> > 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
0
Reply Utf 12/7/2009 6:33:01 PM

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" wrote:

> 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
> 
> 
> "Dale Fye" wrote:
> 
> > 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
> > 
> > 
> > 
> > "rbeach" wrote:
> > 
> > > 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
0
Reply Utf 12/7/2009 7:07:01 PM

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" wrote:

> 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" wrote:
> 
> > 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
> > 
> > 
> > "Dale Fye" wrote:
> > 
> > > 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
> > > 
> > > 
> > > 
> > > "rbeach" wrote:
> > > 
> > > > 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
0
Reply Utf 12/7/2009 7:49:01 PM

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" wrote:

> 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" wrote:
> 
> > 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" wrote:
> > 
> > > 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
> > > 
> > > 
> > > "Dale Fye" wrote:
> > > 
> > > > 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
> > > > 
> > > > 
> > > > 
> > > > "rbeach" wrote:
> > > > 
> > > > > 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
0
Reply Utf 12/7/2009 8:51:01 PM

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" wrote:

> 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" wrote:
> 
> > 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" wrote:
> > 
> > > 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
> > > 
> > > 
> > > "Dale Fye" wrote:
> > > 
> > > > 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
> > > > 
> > > > 
> > > > 
> > > > "rbeach" wrote:
> > > > 
> > > > > 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
0
Reply Utf 12/8/2009 2:12:01 PM

Did you put the code in the Format event of the sub-form, or the main form?

What version of Access are you using?

----
Dale



"rbeach" wrote:

> 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
> 
> 
> "Dale Fye" wrote:
> 
> > 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
> > 
> > 
> > 
> > "rbeach" wrote:
> > 
> > > 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
0
Reply Utf 12/8/2009 2:13:01 PM

7 Replies
365 Views

(page loaded in 0.1 seconds)

Similiar Articles:
















7/26/2012 12:07:39 PM


Reply: