Results 1 to 4 of 4
  1. #1
    pwilson is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    4

    Thumbs down Access yes no field

    I received this code below and it does work. Thank you. The only problem I have now is how to eliminate all the blank lines now in the report where the no's were at.



    I have created a report with several yes/no fields. Out of 12 yes/no fields on the report I only want to see those per record that are checked yes. I do not need to see them if they are checked no. I have tried a couple things and hasn't worked.

    Dim ctl As Control
    For Each ctl In Me.Detail.Controls
    If ctl.ControlType = acCheckBox Then
    ctl.Visible = (ctl.Value = True)
    End If


    Next

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    In the On Format event of the section of the report that they are in (I would assume the Detail Section), use this type of code:
    Code:
    Dim ctl As Control
       For Each ctl In Me.Detail.Controls
          If ctl.ControlType = acCheckBox Then
                ctl.Visible = (ctl.Value = True)
          End If
       Next

  3. #3
    pwilson is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    4
    This is the code I had and it eliminated the no check boxes but left the space in the report where all the other no fields were. Does this make since

  4. #4
    CraigDolphin is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Apr 2009
    Location
    Custer, WA, USA
    Posts
    125
    Have you tried setting the Can Shrink property of the controls in your report to true? That might work. If not, then you will likely need to remove the unwanted rows of data from your report's record source. Assuming it's a query, just add a criteria of -1 to the yes/no field in your query.

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

Similar Threads

  1. Pictures in Access Field
    By cotri in forum Access
    Replies: 2
    Last Post: 09-13-2010, 09:05 AM
  2. Total field with access
    By rev_ollie in forum Queries
    Replies: 0
    Last Post: 04-27-2010, 08:54 AM
  3. access 2007; sql query in a field?
    By cmdturk in forum Access
    Replies: 4
    Last Post: 12-16-2009, 10:25 AM
  4. Field Level Access
    By botts121 in forum Programming
    Replies: 0
    Last Post: 07-09-2009, 11:59 AM
  5. Access does not recognize field
    By Shingo in forum Reports
    Replies: 0
    Last Post: 06-25-2009, 09:17 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