Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    24

    Unanswered: reports, hide/show fields

    hi

    i want this report to show 3 fields (private address fields) when correspondence address = 1, and 3 other fields (institutional address fields) when correspondence address = 2. Anyone know how to do this??

    Another question:
    when i am in a form, i want a button to just print the screen as you see it. Anyone know how to do it? So i'm not talking about printing a report, i just wanna do a printscreen.


    Thanks!!
    -Sam

  2. #2
    Join Date
    Feb 2005
    Location
    Brisbane, Australia
    Posts
    1
    Gday Sam

    Ill have a shot at question 1 but it largely depends on which section of the report you have the controls.

    For the ReportHeader section: -

    Code:
    Option Explicit
    Option Compare Text
    
    
    Private Sub ReportHeader_Format(ByRef intCancel As Integer, _
                                    ByRef intFormatCount As Integer)
                                    
        Dim blnVisibleState As Boolean
        
        On Error GoTo ErrorHandler
        
        blnVisibleState = (Nz(Me.txtCorrespondenceAddress, 0) = 2)
    
        Me.txtInstitutionalAddress1.Visible = blnVisibleState
        Me.txtInstitutionalAddress2.Visible = blnVisibleState
        Me.txtInstitutionalAddress3.Visible = blnVisibleState
    
    ExitProcedure:
        Exit Sub
        
    ErrorHandler:
        MsgBox "Error in ReportHeader_Format : " & Err.Number & vbNewLine & _
               Err.Description
        
        Resume ExitProcedure
        
    End Sub
    Please note I removed any spaces from the names and added a naming convention.

    Hope that helps.

    Regards,
    Chris.

  3. #3
    Join Date
    Sep 2004
    Posts
    24
    Thanks for your reply I find it very useful
    but i already did it another way:


    Private Sub Details_Format(Cancel As Integer, FormatCount As Integer)

    If coradd.Value = 2 Then
    Me.privlabel1.Visible = True
    Me.privlabel2.Visible = True
    Me.privlabel3.Visible = True
    Me.privlabel4.Visible = True

    Me.privveld1.Visible = True
    Me.privveld2.Visible = True
    Me.privveld3.Visible = True
    Me.privveld4.Visible = True

    Me.instlabel1.Visible = False
    Me.instlabel2.Visible = False
    Me.instlabel3.Visible = False
    Me.instlabel4.Visible = False
    Me.instlabel5.Visible = False
    Me.instlabel6.Visible = False

    Me.instveld1.Visible = False
    Me.instveld2.Visible = False
    Me.instveld3.Visible = False
    Me.instveld4.Visible = False
    Me.instveld5.Visible = False
    Me.instveld6.Visible = False

    Else
    If coradd.Value = 1 Then
    Me.privlabel1.Visible = False
    Me.privlabel2.Visible = False
    Me.privlabel3.Visible = False
    Me.privlabel4.Visible = False

    Me.privveld1.Visible = False
    Me.privveld2.Visible = False
    Me.privveld3.Visible = False
    Me.privveld4.Visible = False

    Me.instlabel1.Visible = True
    Me.instlabel2.Visible = True
    Me.instlabel3.Visible = True
    Me.instlabel4.Visible = True
    Me.instlabel5.Visible = True
    Me.instlabel6.Visible = True

    Me.instveld1.Visible = True
    Me.instveld2.Visible = True
    Me.instveld3.Visible = True
    Me.instveld4.Visible = True
    Me.instveld5.Visible = True
    Me.instveld6.Visible = True

    Else
    End If
    End If
    End Sub


    It works so i'll stick with it, any suggestions to make it better?

    Thanks
    Sam.

Posting Permissions

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