Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Location
    Camp Lejeune, North Carolina, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is not null? (2002)

    I am trying to display data in a query for people that have a need to each see different views. The trick is to hide fields that do not contain data. I am trying to use the "Is not null" command to only display fields that have data, but can't seem to get it working. Does anyone have a suggestion? Thanks...

  2. #2
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is not null? (2002)

    Is this data going to be displayed on a form?... one record at a time?
    I just need a clearer picture of what you're doing...

  3. #3
    New Lounger
    Join Date
    Sep 2003
    Location
    Camp Lejeune, North Carolina, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is not null? (2002)

    I collect survey data from people online. This data goes into an access database. There are 6 different people that then each make comments and pass it up to the next person in the chain. If one person had nothing to say, I want to hide their comment field from the others when they view the form. In other words, I don't want a bunch of empty comments fields taking up the screen on the CEO's desk. They are viewing one record at a time. Thanks...

  4. #4
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is not null? (2002)

    Okay... So I'm assuming for now that the comment fields are shown in text boxes on the form...
    I'd use a loop in the On Current event of the Form itself... Something like this...

    Private Sub Form_Current()
    Dim ctl As Control

    ' Enumerate Controls collection.
    For Each ctl In Me.Controls
    ' Check to see if control is text box.
    If ctl.ControlType = acTextBox Then
    ' Check to see if the control is empty.
    If ctl.Value = "" Or IsNull(ctl.Value) Then
    ctl.Visible = False
    Else
    ctl.Visible = True
    End If
    End If
    Next ctl
    End Sub

    HTH <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Is not null? (2002)

    There is another way to solve this problem - if you make the comments a separate table, but linked to the respondant, survey item and the reviewer. Then if a reviewer has no comment for a particular response, then there is no record, and if you use a subform, nothing will be displayed. If this doesn't make sense, post back.
    Wendell

Posting Permissions

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