Results 1 to 4 of 4
  1. #1
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214

    Field Visibility

    I have a report that contains text boxes with dates in them, not all fields have dates. I want the fields that don't have anything in them to be hidden. Below is the code that I have tried but it is not working completely.



    Code:
    Private Sub Report_Load()
    If IsNull(Me.Alabama) Then
    Me.Alabama.Visible = False
    Else
    Me.Alabama.Visible = True
    End If
    End Sub
    This successfully hides the textbox when there is nothing in it but when there is a date in there, it still hides it (when it should be visible).

    Any ideas?

    Thanks.

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    If the date is in some records, but not others, then you have your code in the wrong place; put it in the On Format event of the Detail section.

    You code is fine - but you could replace the If-then-else with one line: Me.Alabama.Visible = not IsNull(Me.Alabama)

    HTH

    John

  3. #3
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    Thank you, that worked. I have a follow up question now...if that line is blank, because of the above code, will that blank line continue to be there or will it go away if I set the property to can shrink?

  4. #4
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    Nevermind, I figured it out. That is what you would do.

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

Similar Threads

  1. [Access2003/2010] Cascading combo box visibility
    By sublevelmonkey in forum Programming
    Replies: 7
    Last Post: 01-19-2012, 10:39 AM
  2. subform visibility
    By nichmeg in forum Forms
    Replies: 9
    Last Post: 11-04-2011, 12:22 PM
  3. Visibility based on Combo selection
    By jlclark4 in forum Forms
    Replies: 1
    Last Post: 12-22-2010, 11:42 AM
  4. Visibility of other controls
    By jlclark4 in forum Forms
    Replies: 7
    Last Post: 12-15-2010, 12:34 PM
  5. Replies: 0
    Last Post: 11-24-2009, 03:23 PM

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