Results 1 to 4 of 4
  1. #1
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53

    Report_Load vs Report_Current

    I have a report that generates one page per record retrieved in a query. Most of the time, the records are 90% the same with minor details being different. This is fine and doesn't affect my report. However, sometimes, a record will have very different information that gets ignored by the report.

    For example, if I have a record that's very different than the others, there are certain controls that I want hidden only on the page with the different record. I tried placing the code both in Report_Load and Report_Current, but the controls are always visible.

    The report code didn't fire at all in Report_Current, and only ran once in Report_Load. So, how do I get my code checked for each new page?

    Below is the code in this example:



    Code:
    //Code located on the Form that generates the report.  Each new page is created here.
    Do While Not rst.EOF
            
                If rst!OrdId = Me.OrdId And rst!ProdId = ## Then 
                    strDocument = "myReport"
                    DoCmd.OpenReport strDocument, acViewPreview, , "([ordid]=" & rst!OrdId & ") And ( Not [CORE]= """ & "LBR" & """)"
            End If
            rst.MoveNext
    
            Loop
    -----
    Code:
    //This code is in the report.  Hides the controls.
     If Me.Face Like "unique identifier" Then
           
            Label98.Visible = False
            Text119.Visible = False
            
        End If

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I've never heard/seen anyone ask for controls on a report to be visible on one page and not another. Would not think this is possible unless you can make the portion that is different be a sub report, and that's assuming you don't want it to be visible on one page but not another. I know you can make a page break visible on one page or another but if anyone can figure out how to do exactly what you're asking, I'll learn something.

    I don't suppose you can use conditional formatting, where fields are invisible based on some report value?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    That code would have to be in Format event for section the control is in. Event only triggers for direct to printer or PrintPreview, not ReportView.

    Could just have expression in textbox: =IIf([Face] Like "unique identifier", Null, [fieldname])

    Could use a textbox with similar expression to serve as 'label': =IIf([Face] Like "unique identifier", Null, "some text")

    Ooops, just read OP again and noticed the 'only on page' requirement. That does definitely complicate.

    Conditional Formatting cannot set control visibility. However, can set backcolor and forecolor same so appears to not be visible.



    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53
    Quote Originally Posted by June7 View Post

    Could just have expression in textbox: =IIf([Face] Like "unique identifier", Null, [fieldname])
    This is working so far. Thank you!

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums