Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    2

    Unanswered: applying settings to all fields in a report

    I have a report that excludes the labels and fields if the field has a null value. I only know how to set the visible setting for each field indivually. Is there a way to apply the setting to all fields in the report?

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.MyField.Visible=Not IsNull(Me.MyField)
    End Sub

    Thanx

  2. #2
    Join Date
    Aug 2002
    Posts
    78

    Re: applying settings to all fields in a report

    If I am getting you correctly you will want to go to design view in the form and do a Ctrl + A. That will select all yoru fields ( Should there be an unwanted field in that list then you will want to hold shift key then deselect which one you want.) When you have all the fields you have that you want to change the properties. . . right click then go to properties. The list of properties that you can change "globally" to the selected items will be available.

    Hope this helps and I understood your question correctly.

  3. #3
    Join Date
    Sep 2002
    Posts
    2
    Actually, I was wondering if there is a way to code one line that will apply to all controls instead of having to code each control like this:

    Me.COMMENTS.Visible = Not IsNull(Me.COMMENTS)
    Me.EFFECTIVITY.Visible = Not IsNull(Me.EFFECTIVITY)
    Me.DES.Visible = Not IsNull(Me.DES)
    Me.L_N.Visible = Not IsNull(Me.L_N)

    I am hoping there is something like this:

    Me.All.Visible = Not IsNull(Me. All)

    This would really save a lot of time for me. I hope this makes more sense.

    Thanx

  4. #4
    Join Date
    Aug 2002
    Posts
    78
    I get it now. . .sorry . . . t_galownia feeling like major duh now LOL

    sorry I am just learning the coding part of it myself.

  5. #5
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34

    Re: applying settings to all fields in a report

    You could use example this code:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim ctl As Control

    'For Each ctl In Me '' for all report controls
    For Each ctl In Me.Detail.Controls '' only Detail section controls
    If ctl.ControlType = 109 Then ' if control is textbox
    ctl.Visible = Not IsNull(ctl.Value)
    End If
    Next

    End Sub

    But why do you need something like that?
    If value is Null there is nothing to print/show.
    If you have choosen some borders or colors ... to control - that will print.

    You can use also CanShrink property!
    If controls CanShrink property is yes conrols are shrinked if value is null.

Posting Permissions

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