Results 1 to 5 of 5
  1. #1
    Ganymede is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    64

    Visible/Invisible textbox on a report that displays multiple records

    I have a report that displays all of my invoices for a given month. Every month I print this report and send it to my accounting department. Sometimes I am forced to cancel an invoice. However, when I cancel an invoice, my office's internal rules prevent me from simply deleting the invoice. I must include the cancelled invoice in my monthly report to the accounting department.



    I want to have a textbox appear/disappear on the invoices I have cancelled. The textbox will be linked to a control source that is from the table where these invoices are generated. It will contain text explaining why the invoice has been cancelled. In addition, there will be a label for this textbox called "Invoice cancelled."

    The question is how I get this label to appear for the invoices that have been cancelled on the report. Here's the code I'm using.

    Code:
    Private Sub Report_Load()
    If IsNull(Me.Text223) Then
    Me.Label236.Visible = False
    Me.Text223.Visible = False
    Else
    Me.Label236.Visible = True
    Me.Text223.Visible = True
    
    
    End If
    End Sub
    When I use this code, the textbox and the label are always invisible, even for the pages of the report containing the invoices I have cancelled (where the control source of Text223 is not null.)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    That's because there is only one label and one textbox. Changing the properties affects all instances of the controls. The load event runs only once. Can try the code in the Detail section Format event but I find this is not always successful either. Be aware Format event runs only when report in PrintPreview or direct to printer.

    Suggest instead of a label use a textbox with an IIf expression that returns Null or text depending on value in another field. That's what I do.
    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.

  3. #3
    Ganymede is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    64
    Quote Originally Posted by June7 View Post
    That's because there is only one label and one textbox. Changing the properties affects all instances of the controls.

    Suggest instead of a label use a textbox with an IIf expression that returns Null or text depending on value in another field. That's what I do.
    Brilliant! Thank you.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    I edited my previous post with more info if you want to review again.
    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.

  5. #5
    Ganymede is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    64
    Quote Originally Posted by June7 View Post
    I edited my previous post with more info if you want to review again.
    Thank you.

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

Similar Threads

  1. Replies: 7
    Last Post: 12-12-2013, 07:11 PM
  2. Replies: 11
    Last Post: 06-30-2011, 11:12 PM
  3. Invisible/visible box
    By teirrah1995 in forum Forms
    Replies: 4
    Last Post: 10-03-2010, 02:45 AM
  4. Setting fields visible/invisible
    By col5473 in forum Forms
    Replies: 1
    Last Post: 09-17-2010, 09:14 AM
  5. Combo Boxes Visible/Invisible
    By Rick West in forum Forms
    Replies: 2
    Last Post: 07-06-2010, 09:41 AM

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