Results 1 to 9 of 9
  1. #1
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94

    Visible Fields in Report if field=x

    Hello all - I have a report with a subreport which displays a list of configuration items for a parent record.



    In the sub report, I want to hide several fields on records which have a field value equal to "x".

    I thought about the onload event, but that is not hiding the fields which should not show up. Any thoughts?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Perhaps you need the On Format event.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    On Format does no show up as valid selection for reports. Any other suggestions?

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    I think you'll find it is a section (Header, Detail, Footer etc) event.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    I see it now. Unfortunately, that does not work. Here is the code which is placed in the "On Format" event where these object reside:

    If IsNull([RIDCert]) Then
    Me.TextRIDCert.Visible = False
    End If

  6. #6
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    change your If statement slightly

    If IsNull([ridcert]) then me.textRIDCert.visible = False Else me.textRIDCert.visible = True

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Insert the line below to test that the code runs when the report opens. After opening the form inspect the immediate window for "No Value"
    If IsNull([RIDCert]) Then
    Debug.Print "No Value"
    Me.TextRIDCert.Visible = False
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Sorry had to rush on my previous response due to work. In the If statement you posted which I'm presuming is in a group section or detail section as soon as the first record that evaluates to true sets the textbox to visible = False. It's never changed back so for every record after that even if the textbox should be there it won't. You need to make sure that you set it back to visible = True when it should be there. For that reason you add the else statement. Sincethat's the only thing your changing you can do it in 1 line of code as I posted. If you have multible options you would have to format it like bob showed

    Code:
    If IsNull([RIDCert]) Then
         Debug.Print "No Value"
         Me.TextRIDCert.Visible = False
    Else
         Debug.print "Some Valule"
         me.txtRidCert.visible = True
    End If
    *Note: I'm making a presumption here as you do not actually specify exactly what's wrong. This is just what I noticed in your post

  9. #9
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    I have a few statements in there an some are working now. I will take what you guys recommended and run with that. Thank you.

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

Similar Threads

  1. Report Fields Visible Based on Checkbox
    By ghillie30 in forum Access
    Replies: 2
    Last Post: 09-21-2011, 09:04 AM
  2. Replies: 11
    Last Post: 06-30-2011, 11:12 PM
  3. Replies: 2
    Last Post: 01-06-2011, 04:38 AM
  4. Report showing non-visible fields
    By AKQTS in forum Forms
    Replies: 2
    Last Post: 09-21-2010, 09:40 AM
  5. Setting fields visible/invisible
    By col5473 in forum Forms
    Replies: 1
    Last Post: 09-17-2010, 09:14 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