Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field references from various report sections

Status
Not open for further replies.

Haccess

Technical User
Mar 23, 2007
24
US
Hi. I need to highlight certain records in a report. My specific question is how to reference a field in a report underlying data source query to change the visible property of a label in the report detail header section. Here's what I'm trying to accomplish:

Code:
 Private Sub CLINHeader_Format(Cancel As Integer, FormatCount As Integer)
    'IS_OPTION is a Yes/No field in the main report query.
    If Me.IS_OPTION = True Then
        Me.lblIS_OPTION.Visible = True
    Else
        Me.lblIS_OPTION.Visible = False
    End If
End Sub

A more general question would be where to find info on all the different ways to refer to a field or a control when building forms and reports.

Thanks!
 
How are ya Haccess . . .

Have a look here: Refer to Form and Subform properties and controls

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
That's a really great reference. Thanks. However, in this specific case I need to check the value of a field, not a control, from the report data source. It is in the underlying query, but not contained within a control anywhere on the report.

How do I update the unbound label's properties based on the value of the unseen Yes/No field?

Thanks!
 
In all versions of Access that I have used, you can't reference a field in a reports record source unless it is bound to a control. You can then reference the control value. The control doesn't have to be visible.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Actually, I just found a thread that explains why my first approach at doing this, conditional formatting of the label, wasn't working:


I was attempting to set the expression to [IS_OPTION] = True. Apparently you need only the field name in the expression for Booleans in Access.

It's working perfectly now, thanks to Remou's post. And Duane's answer explains why I've seen so many "invisible" controls on forms and reports...so you can reference the field without the user seeing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top