Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Magic words (XP)

    Yes, I'm looking for the magic words (an expression? code?) to make a label not visible under certain circumstances. This situation involves a report that lists the courses that a student must complete. We print one report for each student, and we use the paper form to record the student's progress. By the way, these are not students in the traditional sense

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    You can use conditional formatting for text boxes, but not for check boxes and labels, so I'm afraid you'll have to use VBA.

    Open the report in design view.
    Click on the bar at the top of the report header section.
    Activate the Event tab of the Properties window.
    Create an event procedure for the On Format event:

    Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
    Me.[NameOfCheckBox].Visible = (Me.[NameOfCheckBox] = True)
    Me.[NameOfLabel].Visible = (Me.[NameOfCheckBox] = True)
    End Sub

    You must, of course, replace NameOfCheckBox and NameOfLabel with the correct names.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    Good morning, Hans, and thanks for the quick response! I've tried to use your example, but it's not working. No doubt, I've overlooked something, but I can't seem to pin down the problem.

    Here are a few details of the setup: The object with the key property is a text box in the subreport. The text box name: Rev. If a given training plan includes JSEP courses, Rev displays the code for the set of JSEP courses for that training program. Otherwise, Rev displays,

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    Your mention of a box and the phrase "The lab coordinator checks the box ..." made me think indeed that you had a check box. Try replacing both occurrences of (Me.[Rev] = True) with

    (Me.[Rev] = "No JSEP courses.")

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    Well, that same idea occurred to me, and I tried it...with the same result. It also seems to me this particular construction works contrary to what I'm trying to achieve. The label and its companion box should be invisible when the aforementioned text box says "No JSEP courses." So how can I say what I want to say?

    Thanks again for your help!

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    How about inverting it with Not?

    Me.[Label155].Visible = Not (Me.[Rev] = "No JSEP courses.")
    Me.[Box84].Visible = Not (Me.[Rev] = "No JSEP courses.")

  7. #7
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Magic words (XP)

    Try something like:
    <font face="Georgia">
    Me![label].Visible = (Me![Rev] <> "No JSEP courses")
    </font face=georgia>
    (Likewise for your box object.)

    Make sure the text in the quotes exactly matches the text in your nz() function.

  8. #8
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    Hello, Hans and Tom: I regret to report that nothing has changed. I've checked to make sure the text in quotes matches exactly the text in the nz function. I've tried your suggestion and Tom's. Still, when I switch back to Preview and enter the student's payroll ID, the form immediately returns to design view. No error messages of any kind to give a hint as to the source of the problem.

    Could this behavior have anything to do with the fact that I'm trying to make objects on the main report respond to an object inside the subreport?

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    Tom: Thanks for the suggestion. I tried it, but...well, please see my response to Hans.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    How are you referring to the subreport on the main report?

  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    The Parent/Child link is PID. Is that what you mean?

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    You wrote "I'm trying to make objects on the main report respond to an object inside the subreport?" In what way?

  13. #13
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Magic words (XP)

    Why not use a textbox instead of the label?

    Give it a ControlSource of:
    =IIf(Me.[Rev] = "No JSEP courses.","","Student enrolled in JSEP program")

    or have I missed something? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  14. #14
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Magic words (XP)

    The two objects that I want to be visible or invisible (Label155 and Box84) are on the main report, specifically, in the Report Header. The text box that I'm trying to set up as the "trigger" for the visible/invisible status (property) is in a small subreport. This subreport happens to live in the Report Header as well, if that makes any difference. The subreport and the main report are linked on the field PID (payroll ID), which identifies the student whose training plan I want to display.

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Magic words (XP)

    Do you mean that the Rev text box is in the subreport? Or that Rev refers to a text box in the subreport?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •